Answers for "find out the type of a variable in js"

14

javascript how to know type of variable

var foo = "Hello";
console.log(typeof foo); // string
Posted by: Guest on February-20-2020
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
2

javascript get type of var

typeof operando
Posted by: Guest on May-31-2020

Code answers related to "find out the type of a variable in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language