What will be the result of first and second console.log().
console.log(undefined == null)
console.log(undefined === null)
What will be the result of first and second console.log().
console.log(undefined == null)
console.log(undefined === null)
first true and then false
anwer of this question is: true and false
true then false then
ans of this quetions : true , false
first it will true then it is false
first it will true and then false
first true and then false
first true and then false…
first true then false
mam undefined is different value and null is different value then why its true in first ???
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
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’.