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

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?
主站蜘蛛池模板: 句容市| 贞丰县| 光山县| 丰都县| 铜川市| 黎平县| 连州市| 吉林市| 陕西省| 巴林左旗| 福海县| 仲巴县| 宁城县| 龙游县| 桐城市| 通江县| 饶阳县| 宜都市| 镇康县| 威宁| 浦江县| 葫芦岛市| 遂溪县| 铜川市| 望谟县| 盈江县| 吐鲁番市| 环江| 巍山| 恩施市| 开阳县| 惠水县| 武鸣县| 正镶白旗| 科技| 合作市| 民勤县| 乌兰浩特市| 恩平市| 抚远县| 合水县|