Author: Pradeep Kumar

In JavaScript, we have a “string” dataType and it gives us some inbuilt functions now it gives us two functions one is the substring() and the second is the slice().now the substring method is used to get part of a string. Think of it as a way to cut out a piece of the string. You tell the substring() method where to start and where to stop cutting the string.for example:let str = “hello world!” console.log(str.substring(0,2)) //output: “he” now the slice method also works in the same way it takes the starting index and end index and returns the character…

Read More