New Year Sale ! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Microsoft Exam 70-480 Topic 5 Question 5 Discussion

Actual exam question for Microsoft's 70-480 exam
Question #: 5
Topic #: 5
[All 70-480 Questions]

You need to test the value of the following variable in JavaScript.

var length = "75";

A block of code must execute if the length equals 75 regardless of the data type.

You need to use the statement that meets this requirement.

Which lines of code should you use? (Each correct answer presents a complete solution. Choose two.)

Show Suggested Answer Hide Answer
Suggested Answer: B, D

When comparison is made using double-equals operator (==), it will check the values of variable and convert them to a common type and returns true if both are equals. So comparing number with string having the same value will return true.

Examples:

examples:

1

console.log(23 == "23"); // true

2

console.log(1 == true); // true

Incorrect:

not ===: This is ''strict'' or ''identical'' equality.


Contribute your Thoughts:

Currently there are no comments in this discussion, be the first to comment!


Save Cancel