What will be the result of first and second console.log()

What will be the result of first and second console.log().

console.log(undefined == null)

console.log(undefined === null)

2 Likes

first true and then false

2 Likes

anwer of this question is: true and false

2 Likes

true then false then

2 Likes

ans of this quetions : true , false

2 Likes

first it will true then it is false

2 Likes

first it will true and then false

2 Likes

first true and then false

2 Likes

first true and then false…

2 Likes

first true then false

2 Likes

mam undefined is different value and null is different value then why its true in first ???

1 Like

Hi @Amaragarwal7 ,

This is a good question, There are only six falsey values in JavaScript: undefined , null , NaN , 0 , “” (empty string), and false those are return same value.

undefined==null // it will check only for values, hence here it is same and return true.
undefined===null // here it will check values as well as their data types, hence here it returns false
2 Likes

Answer 1: true
Answer 2: false
The action of == will be it will check & compare the values only, it return ‘true’ whenever " both values are be same",
And the action of === will be it will check & “compare the values and datatype” also so, it will return ‘true’ if and only if the values and datatype is similar…
In other cases, if the value is same but the type is different it returns ‘false’.

1 Like