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

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.)

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.)

A.
if (length === 75)

B.
if (length == 75)

C.
if (length != 75)

D.
if (length == “75”)



Leave a Reply 3

Your email address will not be published. Required fields are marked *


bekahugs

bekahugs

I am wondering why it isnt if(length === 75)? Does anyone know?

c

c

=== 75 would match type and value, rather than just value.

Robin

Robin

=== check the corresponding data type.. if datatype is not matched then it is false even if the value is same.