LoginSignup
0
0

More than 5 years have passed since last update.

JavaScriptはnull以外のオブジェクトはtrue判定される

Last updated at Posted at 2017-12-03

JavaScriptはnull以外のオブジェクトはtrue判定される

    var hoge = "nullじゃないよ";
    var fuga;

    if(hoge){
        console.log("hogeがtrue判定されたよ");
    }

    if(!fuga){
        console.log("fugaがfalse判定されたよ");
    }

/*実行結果--------------
hogeがture判定されたよ
fugaがfalse判定されたよ
-----------------------*/
0
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
0
0