TypeError: undefined is not a function (evaluating 'Number.isNaN(6)')

TypeError: undefined is not a function (evaluating 'Number.isNaN(6)')
0.0 0

#1

I created a simple Typescript project. I added this in ChildClass.ts file

if (Number.isNaN(6)) {
    console.log("it is NaN");
    return;
} else {
    console.log("everything looks fine");
}

I tested it on simulator and on browser. Everything is fine. Then I got iOS build. Then compiled. Everything went well. I opened Xcode and run. And I got the error saying TypeError undefined is not a function at Number.isNaN(6)
I tested same code in different machine there was no error. What the heck am I doing wrong?

Creator 1.7.0 (no custom build templates)
Xcode 9.1 (9B55)
jsconfig.json -> target: “es6”
tsconfig.json -> in compilerOptions -> lib: [“dom”, “es5”, “es2015.promise”, “es6”]


#2

If I use isNaN(6) instead of Number.isNaN(6) it works without any problem.


#3

it could be the javascript engine (which engine would it be using running on Ios - Safari’s I guess?)

number.isNan is newer and less well supported, so that sounds likely to me


#4

Thanks for the reply @Maxxx I will check this.
But same code in my machine (macos high sierra - Use builtin Javascript Engine checked) works without any error.