Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to check data type of javascript variable

let counter = 120; // counter is a number
console.log(typeof(counter)); // "number"

counter = false;   // counter is now a boolean
console.log(typeof(counter)); // "boolean"

counter = "Hi";   // counter is now a string
console.log(typeof(counter)); // "string"Code language: JavaScript (javascript)
Comment

check data type in js

typeof("string"); //string
typeof(123); //number
Comment

check data type in js

typeof("iAmAString");//This should return 'string'
//NO camelCase, as it is a JS Keyword
Comment

js check data type

typeof(variable)
Comment

check data type in js

var x = "Hello World";
typeof x; // "string"
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to install exact package lock version in package-lock.json 
Javascript :: learn express 
Javascript :: javascript Arrow Function with One Argumen 
Javascript :: css select all links in div 
Javascript :: settimeout with loop js 
Javascript :: jquery datatable update row cell value 
Javascript :: redux toolkit 
Javascript :: connect mongodb using mongoose in node js 
Javascript :: react materialize cdn 
Javascript :: javascript remove json element 
Javascript :: firebase user sign out 
Javascript :: javascript keep scroll visible 
Javascript :: new line in javascript string 
Javascript :: react router path array 
Javascript :: generator function javascript 
Javascript :: center canvas p5js 
Javascript :: how to run node js with proxy 
Javascript :: math random javascript 
Javascript :: C# Convert Json File to DataTable 
Javascript :: javascript string() function 
Javascript :: import all images from folder react 
Javascript :: js promise 
Javascript :: js knex migration 
Javascript :: template literal syntax 
Javascript :: pause console debugger in react 
Javascript :: javascript boolean 
Javascript :: Substring in Javascript using substr 
Javascript :: searc and replace fcc solution 
Javascript :: change image automaticly 
Javascript :: vue store access state in actions 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =