diff --git a/implementations/isNaN.js b/implementations/isNaN.js new file mode 100644 index 0000000..e4d9ca9 --- /dev/null +++ b/implementations/isNaN.js @@ -0,0 +1,14 @@ +/** + * + The isNaN() method checks if passed value is NaN + + MDN Link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN + */ + +Number.prototype.ownIsNaN = function ownIsNaN(value) { + let x = Number(value); + return x !== x; +} + +// test cases +// {},'',null,undefined,' ',NaN,Infinity,true,false,'Infinity',[],new Date(),new Date().toString() \ No newline at end of file