JavaScript distinguishes between values and objects
In Java Integer is an object and int is a primitive type (a plain value), that can be converted to the Integer object using Java's auto-boxing capability. JavaScript is similar: Executing the following in Chrome's Developer Tools JavaScript console, will show you the difference between an object and a number in JavaScript:
So you see that var myNum = 1; isn't the same as var myNum = Number(1);.
Comments
Post a Comment