Answers for "js get variale type"

3

get type of var js

function doSomething(x) {
  if(typeof(x) === 'string') {
    alert('x is a string')
  } else if(typeof(x) === 'number') {
    alert('x is a number')
  }
}
Posted by: Guest on October-12-2020
1

node js check type of variable

if (typeof i != "number") {
    console.log('This is not number');
}
Posted by: Guest on April-03-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language