For example you have a TS app: enum PaylerPosition { Guard, Forward, Center } interface Player { name: string; position: PlayerPosition; } let kobe = { name: 'Kobe', position: PlayerPosition.Guard }; The problem for this piece of code is that, you ca…
This lesson introduces the --strictNullChecks compiler option and explains how non-nullable types differ from nullable types. It also illustrates how you can write safer code by being explicit about null and undefined in the type system. First of all…
浅谈JS中的!=.== .!==.===的用法和区别 var num = 1; var str = '1'; var test = 1; test == num //true 相同类型 相同值 test === num //true 相同类型 相同值 test !== num //false test与num类型相同,其值也相同, 非运算肯定是false num == str //true 把str转换为数字,检查其是否相等. nu…