Some important topics in JavaScript
May 5, 2021
1) String.prototype.indexOf()
This method find the index number of a string type variable
const text = “We love our country”;
console.log(text); //We love our country
console.log(text.indexOf(“our”)); //8
2) String.prototype.includes()
This method return Boolean type if the word present in the string it returns true if not present then it returns false.
const text = “We love our country”;
console.log(text.includes(“our”));//true
console.log(text.includes(“unknown”));//false
3) String.prototype.toLowerCase()
This method returns the lower case format of the string
const text = “We love our country”;
console.log(text.toLowerCase()); //we love our country