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