For example, API response is: "Test": { "Test1": 390, "Test2": "391" }
I just want check that the Test1 returning integer value and Test2 is returning string value without verifying the actual value (ex: 390) returned by the field.
For example, API response is: "Test": { "Test1": 390, "Test2": "391" }
I just want check that the Test1 returning integer value and Test2 is returning string value without verifying the actual value (ex: 390) returned by the field.
isNaN
returns true if the supplied argument isNotaNumber. (i.e. you want false from isNaN)
var obj = { val: 12345 };
console.log(!isNaN(obj.val)); // true. its integer
you can use typeof(), ie:
var montexte="montexte"
var monchiffre=50
console.log('texte ? ' + typeof(montexte)) // gives string
console.log('chiffre ? ' + typeof(monchiffre)) // gives number
hope this helps