I am using typescript for the first time, and I face a quite strange problem.
I am trying to make calculation like a calculator, so when a user press a button it could be a digit, 2 3 4 ... or an operation * \ + ...
On button press, I call a function, and the function check if it is a digit, or an operation in order to call the adequate function.
I compare my string like this :
if (Number(value) !== NaN) {
// it is a number
} else {
// it is an operation
}
although this work in the console ( by that I mean I do have a digit (3,4,5) when I press a number and NaN when I press an operation) this line ALWAYS return true, so I always consider it a number.
What am I doing wrong here?
thanks