官术网_书友最值得收藏!

Questions

Here are some questions to test what you have learned in this first chapter. The answers can be found in the appendix.

Good luck!

  1. What are the 5 primitive types?
  2. What would the inferred type be for the flag variable be in the following code?
 const flag = false;
  1. What's the difference between an interface and a type alias?
  2. What is wrong with the following code? How could this be resolved?
class Product {
constructor(public name: string, public unitPrice: number) {}
}

let table = new Product();
table.name = "Table";
table.unitPrice = 700;
  1. If we want our TypeScript program to support IE11, what should the compiler--target option be?
  2. Is it possible to get the TypeScript compiler to transpile ES6 .js files? If so, how?
  3. How can we prevent console.log() statements from getting into our code?
主站蜘蛛池模板: 唐河县| 封丘县| 汉阴县| 漳平市| 临沂市| 拜泉县| 迁安市| 双桥区| 怀集县| 灵川县| 周宁县| 关岭| 县级市| 五华县| 陇西县| 吉隆县| 睢宁县| 神农架林区| 汕头市| 嫩江县| 白朗县| 枣强县| 张家界市| 武乡县| 县级市| 开阳县| 色达县| 东光县| 蒙阴县| 青海省| 绥江县| 张家口市| 桐庐县| 柘城县| 垫江县| 南漳县| 宜兴市| 铁力市| 海林市| 汉中市| 新乐市|