akram.dag avatar

How to know the Data Type of a variable's value

akram.dag

Published: 21 Dec 2019 › Updated: 21 Dec 2019How to know the Data Type of a variable's value

How to know the Data Type of a variable's value

#JS-BEGINNERS-SERIES #lesson-002

How to know the Data Type of a variable

Sometimes beginner developers forget about the javascript data types, and in some situations, a developer needs to check the data type of a certain variable's value without searching on the internet.
There is an easy way in the js language itself which is the typeof operator

let myVar = "I am ";
console.log(typeof myVar);
//  output : string

let myNum = 14;
console.log(typeof myNum);
// output : number

let myAge = myVar + myNum;
console.log(typeof myAge);
// output : string

Leave How to know the Data Type of a variable's value to:

Written by

Read more #javascript posts


Best Posts From akram.dag

We have not curated any of akram.dag's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From akram.dag