-
properties
let userName = "kalyan\""; // \" is of 1 length console.log(userName.length) // This is a property -
functions
-
console.log(userName.toUpperCase()) // This is function () // Kalyan , index starts from 0 console.log(userName.slice(1,3)) // last index not included console.log(userName.slice(1)) // if second is not given goes to end console.log(userName.replace("kal","kir")) // replace , case sensitive let friend = "pavan" console.log(userName.concat("is good frined of ",friend , " !")) let friend2 = " satish "; console.log(friend2) console.log(friend2.trim()) // removes spaces and newlines // Others string methods are present in mdn string docs
-
-
Strings are immutable
-
let a = "ka"; a[1] = "l"; console.log(a) // All these functions are not mofiying actual srting , string is immutable
-
Java Script
String Methods
-
properties
-
functions
-
-
Strings are immutable
-