Methods in JavaScript is like a function which we can perform on objects or on array or on string .It is a property of an object which contains function defination.
We will see here useful string methods and array methods.
This is a string method which copy some part of string without modifiying the original string.
Example :- On string
var str = "JavaScrispant is cool" ;On Array
const flowers = ["Rose" , "Sunflower" , "daffodils", "Lily"];
As the name says itself this method converts the String to uppercase but without affecting the original string.
Example :- var str = "kajal kumari"
As the name says itself this method converts the String to Lowercase but without affecting the original string.
Example :- var str = "JAVASCRIPT"
This method return a new string based on provided replacement after replacing it in string.
Example :- 1. var str = "15-09-2021"
2.var str2 = "write the Blog"
This method return specified character from a string of specified index.
Example :- var str = "Hello World!"
This method split the string on the basis of argument you pass in it.
Example :- var str = "Welcome to programming world!"
This method return an array of string joining all the breakpoints
Example :- var arr = ["Welcome" ,"to","programming" "world!"]
This method reverse the order of the array and then return it as array of strings.
Example:- var arr = ['W', 'e', 'l', 'c', 'o', 'm', 'e']
Hope you enjoyed the blog. For now bye bye 🚶♀️