2009-01-29から1日間の記事一覧
今までずっとtypeof()を使い、以下の様にチェックしていた。 function hoge(a) { if( "undefined" == typeof(a) ) { alert("引数省略"); } else { alert("引数あり"); } } しかし以下の様に書ける。 function hoge(a) { if(!a) { alert("引数省略"); } else …
今までずっとtypeof()を使い、以下の様にチェックしていた。 function hoge(a) { if( "undefined" == typeof(a) ) { alert("引数省略"); } else { alert("引数あり"); } } しかし以下の様に書ける。 function hoge(a) { if(!a) { alert("引数省略"); } else …