Get Better javascript string Results By Following 8 Simple Steps

Juned Ahmed
3 min readJun 3, 2021

Today I’m going to discuss the javaScript string as simple as possible

Javascript is a client-side scripting language or browser scripting. Client-side scripting means the web browser is able to run/execute this script. The Server-side is opposite of the client-side and the server-side script executes/runs from the webserver.

Javascript string is some alphabet set. For example “Hello World” or ‘How are you” — this is a JavaScript string. Because putting something inside a double or single quotation is considered a string. Even “25” is a string but 25 is not a string. Two examples:

javascript string

If you want to add something after already creating a string, then you can do this by backslash (\). Example:

You can use the JavaScript .length method for known string lengths

JavaScript string Is Essential For Your Success. Read This 8 Simple of the JavaScript methods

Method 1) charAt(): in this charAt() method you can able to know your string letter position. Example:

Here 2 is the index position value. you can change and figure out what happens after value change.

Method 2) concat(): The concat() method passes the argument string and returns a new string. Example:

Method 3) includes(): The includes() is a javaScript case sensitive search string method. This string’s returning true or false value. Example:

Method 4) endsWith(): The endsWith() method is similar to includes() method because endsWith() returns true or false value but different is endsWith() method determines whether a string ends with the characters of a specified string. Example:

Method 5) indexOf: The indexOf() javaScript method find out string object word position value. Starting the search fromIndex . Example:

Method 6) lastIndexOf: The lastIndexOf() javaScript method is similar to indexOf() method and both find out string object word position value. But different is lastIndex() Starting the search fromLastIndex . Example:

Method 7) replace(): The replace() method replaces a javascript string with some or all matches of a pattern string. The pattern can be string or RegExp. Example:

Method slice(): The slice() method returns a new sub string without modifying the original string. Example:

Thank you for reading with spending your valuable time.

--

--

Juned Ahmed

I enjoy developing applications using modern technologies. Proficient in JavaScript, Reactjs, Nodejs, Expressjs and MongoDB. Passionate about new technologies.