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

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?
主站蜘蛛池模板: 吴旗县| 郴州市| 阜宁县| 左贡县| 东城区| 湘西| 巴楚县| 张家川| 平武县| 大连市| 建水县| 嘉禾县| 寻乌县| 宿州市| 洪雅县| 偏关县| 六盘水市| 吴桥县| 当雄县| 九江市| 东辽县| 康定县| 潼关县| 昭平县| 壶关县| 亳州市| 长武县| 临邑县| 安塞县| 天镇县| 灵石县| 永福县| 莱西市| 邛崃市| 女性| 石台县| 江源县| 班玛县| 海晏县| 呼玛县| 兖州市|