4 is our start point
25 is our end point
now if you print the value of
To find the length of any string, you need to use
.length property, here is an example
Note: while writing the above code, have you noticed that we used
= equal sign? that’s not equal, that’s the way assigning the value to a variable.
Slice is almost same as Substring, but here you can specify negative number too
trim() method used for removing the extra space in front and back
indexOf() method used for finding the position of a string within a string
in above example you see can see the position of word "learning" within that sentence
You also can sepcify the start index in case there are multiple location of string you are looking for.
Notice, in above example, we have replaced