उदाहरण
typeof ऑपरेटर से विभिन्न डेटा टाइप्स चेक करें।
var number = 10;
var stringValue = "John";
var booleanValue = true;
var obj = {};
var newArray = new Array();
console.log("The data type is=" + typeof number);
console.log("The data type is=" + typeof stringValue);
console.log("The data type is=" + typeof booleanValue);
console.log("The data type is=" + typeof obj);
console.log("The data type is=" + typeof newArray);
प्रोग्राम चलाने के लिए:
node fileName.js
आउटपुट
PS C:\Users\Amit\JavaScript-code> node demo162.js The data type is=number The data type is=string The data type is=boolean The data type is=object The data type is=object