LoginSignup
1
0

#プログラミング #Javascript # バグネタ

Posted at

ずっと使ってる人だと当然だろうけど、たまに使うと忘れててやらかすもの。

> a=undefined;if(a==undefined){console.log("undefined")}else{console.log("not undefined")}
> undefined
> a=1;if(a==undefined){console.log("undefined")}else{console.log("not undefined")}
> not undefined
> a=null;if(a==undefined){console.log("undefined")}else{console.log("not undefined")}
> undefined

おい!(笑)
強引に解釈するなら、nullは値ではなく型なので、値判定だと値無しのundefinedという感じかな。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0