JavaScript String Methods

1/21/2020 12:00:00 AM

JavaScript have many string methods for string modification or we can get many properties of the string using this string method. JavaScript string methods are very useful for programmer to get the many important property or specific value from the any string. Now given bellow some string function name:
•    indexOf
•    lastIndexOf
•    length
•    search
•    slice
•    replace
•    toLowerCase
•    toUpperCase
Now given bellow the string method code and explain the code:

<!DOCTYPE html>
<script type="text/javascript">
var name = "Farhan Sakib Jesy!";
//get the index
//get the length
//returns the position of the first occurrence of a specified text in a string
//get specific words from string
console.log(name.slice(0, 13));
//replace specific word
console.log(name.replace("Jesy", "...."))
//get Lower Case
//get Upper Case

In this code we have a variable name as “name”. This name variable contains the my “Farhan Sakib Jesy” string. This string modifies, replace, Upper case or Lower case etc perform by the string functions. We can easily write our code using this function. If we use this function our code will be more read abele and clean for the programmer.