'How can we make a difference between "1" and 1 ? ("1" !== 1)
I'm trying to make a function who want to say :
if ("1") false;
if (1) true;
i have try isInteger(), typeOf, isNaN(), etc ... But i can't find a solution ...
it's for my validator in node.js, i use "yup".
here an example :
const isNumber = yup
.number()
.positive()
.test('number', 'verify number', (val) => {
if (typeof val === 'number') {
return true;
}
return false;
})
.required();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
