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

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?
主站蜘蛛池模板: 如皋市| 张掖市| 堆龙德庆县| 云和县| 军事| 哈密市| 闻喜县| 东光县| 通州市| 博客| 乌恰县| 岳普湖县| 新宾| 施秉县| 体育| 陕西省| 临安市| 木兰县| 冷水江市| 怀安县| 卢氏县| 固始县| 南木林县| 右玉县| 蒙自县| 汕头市| 马鞍山市| 孙吴县| 昌黎县| 麻阳| 运城市| 德安县| 博白县| 临海市| 山东| 兴隆县| 延边| 南华县| 江口县| 和政县| 砀山县|