showing results for - "get type of var js"
Lina
27 Jan 2017
1function doSomething(x) {
2  if(typeof(x) === 'string') {
3    alert('x is a string')
4  } else if(typeof(x) === 'number') {
5    alert('x is a number')
6  }
7}
Lara
28 Sep 2016
1// get type of variable
2
3var number = 1
4var string = 'hello world'
5var dict = {a: 1, b: 2, c: 3}
6
7console.log(typeof number) // number
8console.log(typeof string) // string
9console.log(typeof dict)   // object
Keisha
07 Jun 2020
1var x = 12345; 
2console.log(typeof x) // number
3x = 'string'; 
4console.log(typeof x) // string
5x = { key: 'value' };
6console.log(typeof x) // object
queries leading to this page
how to check type of variable in javascriptget datatype of a variable in jsjs get var typeget the var type javascriptget variable type in jstypeof 28 29 in jstype of value jshow to know variable type in javascriptget type of var jsget data type of variable javascriptjs variable typestype of variable in javascripttype of a variable in javascriptis type of javascriptjs how to see the typehow to find type of variable in javascripttypeof stringvariable type javascriptjavascript get value typetypeof js get the variable type in jstype of var jsjavascript variable typeofget the type of variable in javascriptjs typeof functionjavascript get type of valuetype of in javascriptjavascript get variable data typejavascript data types checkjs typeof get var typejs get data typejavascript get variable typedeclare type of variable jsget variable type javascripthow to getr the type of in javascriptcheck datatype of variable in javascripthow to know type of variable javascriptget type javascriptjavascript typeof vartype variable javascripttype of variable node jsjavascript variable typeget the typeof a variable in javascriptget type of variable javascriptjs variable with typejavasciprt get typetypeof in javascript examplecheck type of variable jstype jsvar type javascriptgettype in javascriptget the type of an object javascriptnode get type of variableget type of variablehow to check type of a variable in javascripttest type javascriptvariable types in javascripttype of value in javascriptjavascript get var typecheck type of variable javascriptcheck the type of element in javascripthow to get type jsget the type jsget type of variable jsjavascript get datatypejavascript is type ofjavascript number data typesjavascript typeof variablehow to know the type in javascriptprint type javascriptjavascript get typejs typeif typeof javascriptjs type ofget type in javasctipttype in jsfind type variable javascriptget type in javascriptget data type of variable in javascriptget type of a variable in jshow get type of value in jsjavascript typeoftypeof in javascriptget var type javascriptcheck the type of a var jsvalue type javascriptjavascript get typeget type of variable in javascripthow to check the type in javascriptfind the type in javascripttype of variable javascriptjavascript get type of variablefind the type of parameter jsvartype js js get typejs how to get type of variableget type of javascriptjavascript gettype variabletypeof variable in javascriptif datatypeof jshow to check data type in javascripttype of value javascriptvar type jdata type of variable javascripttype of in jstypeof string check javascriptjs find type of valuegettype in jsjavascript value typejavascript console type of variablejavascript variable typesjavascript which typegettype javascriptchar data type in javascriptjavascript var typetype in javascripthow to get the type of value in javasciptget the type in jsjavascript type of variablejs get type of variablehow to type of variable in jsjs check type of elementcan you output the type of a variable in javascriptcheck type of variable in javascripttype of variable jsjs type of varfind variable type in javascripttype of syntax jsjavascript check variable typevariable type in javascripttype of variable in jsjs typeofjs typeof variablehow to get type in jstype of js variableget type of var in jsget type jsget type of var javascripttype of jstypeoftype variable jshow to check data type of variable in javascripttype of var in javascriptget typeof variable javascriptget type value javascriptget type of var js