javascript - Strong equality -
you have been instructed test value of variable shown below:
var length = "50"; you write next code:
if (length === 50) which of next purpose of line of code?
a. prevents block of code firing if length equals 50, , info type integer.
b. prevents block of code firing if length equals 50, , info type string.
c. allows block of code fire if length equals 50 regardless of info type.
d. allows block of code firing if length equals 50 depending on info type.
can have reply above ?
my reply d.but says wrong.what yours ?
var myinteger = 50; if(myinteger === 50) { alert("matched integer"); } if(myinteger === "50") { alert("matched string version of integer"); }
http://jsfiddle.net/8rdlk/
only first if block matches, reply d.
javascript jquery
No comments:
Post a Comment