JavaScript Strings In a Nutshell

source Unsplash

1. Single quotes.

2. Double quotes.

3) Backticks.

1) Length

The length property returns the length of a string:

2) Extracting strings

  • slice(start, end)
  • substring(start, end)
  • substr(start, length)

3)Replace Method

The replace() method replaces a specified value with another value in a string:

4)Upper and Lower Case

A string is converted to upper case with toUpperCase():

5) charAt

The charAt() method returns the character at a specified index (position) in a string:

Conclusion

We discussed the different ways in which we can declare a strings and few methods of strings in JavaScript.Hope you learned something.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adarsh gupta

Adarsh gupta

531 Followers

Software Engineer | JavaScript developer | Technical Writer . Work with me? adarshguptaworks@gmail.com