-
Notifications
You must be signed in to change notification settings - Fork 0
04 Data Type
Biswajit Sundara edited this page May 1, 2023
·
2 revisions
Java Script supports primitive data types - String, Number, Boolean & composite data types such as object, array, regular expression.
//string values with single quote
let fname='Biswajit'
console.log(fname);
//string values with double quote
let lname="Sundara"
console.log(lname);
//when we have a single quote inside the string then use double quotes else it will error
let para="I've a pen"
console.log(para);Now a days back ticks are widely used. We can use $ symbol and the variable directly when we use back ticks. Look at the example below.
let fname='Biswajit'
console.log("My name is" +fname);
console.log(`My name is ${fname}`);let age=30
console.log(age);
let salary=33.33
console.log(salary);let married=true
console.log(married);We can check the data type of variable using typeof keyword.
let name="biswajit";
let strype= typeof name;
console.log(strype);
let age=30;
let numtype=typeof age;
console.log(numtype);
let married=true;
let blntype=typeof married;
console.log(blntype);