Answers for "how to know the type in javascript"

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

Code answers related to "how to know the type in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language