Answers for "how do you check if a javascript object is a number or string"

5

js test if string

if (typeof string === 'string') { /* code */ };
Posted by: Guest on April-18-2020
4

javascript check if variable is number

function isNumber(n) {
  return !isNaN(parseFloat(n)) && !isNaN(n - 0);
}
Posted by: Guest on May-22-2020

Code answers related to "how do you check if a javascript object is a number or string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language