| Viewed 141 times

How to check data type in javascript

list of all javascript datatype and how to declare an integer in javascript

1 Answer
Mohammad Qandeel
  • Numbers
  • Strings
  • Booleans
  • Arrays Objects

Understanding Data Types in JavaScript is very important because it determines what values you can assign.

JavaScript has dynamic data types that mean the same variable can be used to hold different data types 


var a;               // Datatype of a is undefined
a = 101;            // Datatype of a is a Number
a = "Qandeel";     // Datatype of a is a String

You can try the JavaScript typeof operator to check the data type of a variable


console.log(typeof "text"); // text
console.log(typeof 5);     // number
console.log(typeof ][);   // object

Related Questions