Monday, February 12, 2018

The difference between number and Number in JavaScript is that number is a primitive type and Number an object type.

Stack Overflow has an example of Number with this in it:

var x = new Number(34);

 
 

As much would also explain the difference between boolean and Boolean in TypeScript. The difference is not one of TypeScript. It is of JavaScript. It looks like with the types with a capital letter you may make a strict assignment in lieu of using the new keyword too. This TypeScript throws no errors:

let myBoolean: Boolean = false;
myBoolean = true;
alert(myBoolean);

No comments:

Post a Comment