How to convert number data type to string data type in javascript using + operator and empty string

Published: 03 January 2023
on channel: Tech Nursery
9
0

In this video i explain How to convert number to string data type in javascript
I use + operator and empty string to convert number data type value to string data type value in javascript. Both number and string are primitive data types in javascript


const num= 123
const str= num + "";
console.log(str);
console.log(typeof str);
console.log(typeof num);


const num= 123
Here i declared num variable which is a number data type in javascript and i assigned a value 123

const str= num + "";
Then by using + operator and empty string , i converted num value to string data type in javascript.

Now i checked data type of both str and num using typeof operator of javascript

console.log(typeof str);
console.log(typeof num);

So we can convert number data type value in javascript to string data type value in javascript using + operator and empty string


Watch video How to convert number data type to string data type in javascript using + operator and empty string online without registration, duration hours minute second in high quality. This video was added by user Tech Nursery 03 January 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 9 once and liked it 0 people.