1.The following will evaluate display false. var a = 1; var b = "1"; console.log(a === b); True or False? 2.What is the value of a after executing the following code snippet? var a = 1; a += 1; 1 undefined 2 0 3.Operators at the same level of precedence associate(evaluate) from right to left. True or False? 4.The following code will display true. var a = 1; var b = 2; console.log(a === b); True or False?
1.The following will evaluate display false.
var a = 1;
var b = "1";
console.log(a === b);
True or False?
2.What is the value of a after executing the following code snippet?
var a = 1;
a += 1;
1
undefined
2
0
3.Operators at the same level of precedence associate(evaluate) from right to left.
True or False?
4.The following code will display true.
var a = 1;
var b = 2;
console.log(a === b);
True or False?
1- false
var a = 1;
var b = "1";
console.log(a === b);
=== (Triple equals) is a strict equality comparison operator in JavaScript, which returns false for the values which are not of a comparable type. This operator performs kind casting for equality. If we examine 2 with "2" using ===, then it will return a false.
Strict equality === tests that values are identical or no longer.
Value isn't implicitly transformed to some different fee before assessment.
If the variable values are of various sorts, then the values are considered unequal.
If the variable is of the same kind, is not numeric, and features the identical cost, they're taken into consideration the same.
Lastly, If both variable values are numbers, they're taken into consideration the same if each isn't NaN (Not a Number) and are the same value.
2.
2
var a = 1;
a += 1;
a value is 1 as a number then a +=1 it means a=a+1.
a=a+1; // a value is already 1 now.
a=1+1 =2;
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images