「JavaScript」グローバルプロパティNaNのサンプル
説明
NaN はグローバルオブジェクトのプロパティです。
使用例
function testFunc(a) {
if (isNaN(a)) {
return NaN;
}
return a;
}
console.log(testFunc('testmsg'));
console.log(testFunc('456'));
実行結果
> NaN
> “456"
Coding Changes the World
説明
NaN はグローバルオブジェクトのプロパティです。
使用例
function testFunc(a) {
if (isNaN(a)) {
return NaN;
}
return a;
}
console.log(testFunc('testmsg'));
console.log(testFunc('456'));
実行結果
> NaN
> “456"