Create a String in js
String
there are three ways to create a string in javascript :
1- Literal creation . ✅
let myStr = " Hend Ahmed";
console.log(typeOf(myStr)); // string
2- String Function . ✅
let myStr = string("Hend Ahmed");
console.log(typeOf(myStr)); // string
3- Constructor . (❌ Dont use this method)
let myStr = new string("Hend Ahmed");
console.log(typeOf(myStr)); // Object
so Don't use the last way because it causes a complicated code and a slow performance .

Comments
Post a Comment