DEV Community

Cover image for JAVASCRIPT STRING METHODS
Nesat Nayem
Nesat Nayem

Posted on

JAVASCRIPT STRING METHODS

Javascript string is a character it’s reprajent series of characters

And javascript has a lot of string methods which is help to make complex things easy like:

charAt: It’s a method which is provide the character value to specific index so that’s mens return the character in the specific index.

Concat: it’s doing a connection of tow or more then tow string and then return a new string.

Includes: javascript includes method is use for determine where is string pragent or not it’s a case sensitive method and it’s return boolean like true of false;

Endswith: it’s follow the rule like where the specific character is ends and it’s always return true or false.

indexOf: this keyword use for search index the creature where is it position in all and fiend it index. And it provide index number or if not it provide -1.

lastIndexOf: if provide the search character last position and it’s fast position is zero.

Replace: it’s doing change or repleace a specific world of sentence to use replace method.

Slice: this is use for sciceing many data how many data you want to show ui to use this method you can chose a number of data howavare you want just set quantity and then apply slice method that’s it.

Split: it’s work it’s abstring array and then return a newly created array.

startsWith: it return true if string start with a specific string. it’s a case sensitive method.

Substr: this use case is fetch to given string to provide specific string position and length.
toLowerCase: it’s mainly use if you need a world written capital letter but you need it lower case this situation you use this method and when apply this method you capital word or sentence is just convery lowercase.

toUpperCase: this method are same like this where you want to convery upper case to lower case and now you want to lowercase to uppercase so just use toUpperCase and it’s done.

Trim: this trime is remove to help white space in left or right if we fase whilte space in you left of right site and need to remove it just use this trim ane solve it cleanly.

trimStart: it’s use case is just remove starting whitespace not remove end white space

trimEnd: same thing are doing stimEnd it’s mens delete white space in the end site that it.

valueOf: it return primitive value of specific object.

This are import string we use so many case to easser our coding and save mutch more time and a better code environment for acceptable all platform like asynchronous.

Top comments (0)