javascript - Is there a big difference between reference and primitive types of boolean, number etc.? -


i rad, can create numbers as:

var num = 10;

and:

var num = new number(10);

may use first variation of declaration?

yes, use first 1 always, returns primitive value.

the second method looks returns primitive value doesn't. infact, returns object boxed primitive value.

to explain this, lets declare 2 variables:

var = 2; var b = new number(2); 

the expression a == b return true since javascript coerces b primitive value of 2. however, expression a === b return false types different: a being primitive , b being object.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -