0
var a,b,c,d; b=a; c=a+b; d=c-a; alert(d==b);
//output= false //do u have any explanation?
7 Answers
+ 1
you didn't assign any value. so NaN != undefined
0
Elie! why have assigned d to 2??
0
the coding missing numbers, it give undefined if there's no numbers...i gived you example with numbers
0
ok, I mean the example is wrong
0
yep to get false you need to assign a number to var a b c d
0
best practice is to declare each variable separate, not all ina single line.
then assign each variable immediately a value, request memory resources and initialization go should go in one step if possible.
- 1
par example
a=4
b=5
c=6
d=1
b=a ----> b=4
c=a+b -----> c=4+5 ---->c=9
d=c-a ----> d=6-4 ---->d=2
d==b ---> 2==4
Not Equal --> false