String || String Objects || String methods In JavaScript | JavaScript Course for Beginners

Publicado el: 22 mayo 2023
en el canal de: Parnika Tutorials
77
4

In this video, we're going to learn about string methods in JavaScript. We'll cover topics like trim(), substring(), join() and more.

If you're learning JavaScript, then this is a must-watch video! We'll cover everything you need to know about string methods in JavaScript, from how to use them to how to improve your code literacy! By the end of this video, you'll be able to use string methods to improve your programming skills!
#javascript #html #stringmethods #fullstackdevelopment
A JavaScript string is zero or more characters written inside quotes.

Example
let text = "John Doe";

String Length
To find the length of a string, use the built-in length property:

Example
let text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let length = text.length;

Extracting String Parts
There are 3 methods for extracting a part of a string:

slice(start, end)
substring(start, end)
substr(start, length)
JavaScript String slice()
slice() extracts a part of a string and returns the extracted part in a new string.

The method takes 2 parameters: start position, and end position (end not included).

The replace() method returns a new string with the specified string/regex replaced.

replace() Parameter
The replace() method takes in:

pattern - either a string or a regex that is to be replaced
replacement - the pattern is replaced with this replacement (can be either a string or a function)

The string indexOf() method returns the index of the first occurence of the substring in a string.

he syntax of the indexOf() method is:

str.indexOf(searchValue, fromIndex)
Here, str is a string.

indexOf() Parameters
The indexOf() method takes in:

searchValue - The value to search for in the string. If no string is provided explicitly, "undefined" will be searched.
fromIndex (optional) - The index to start the search at. By default it is 0. If fromIndex is less than 0, the search starts at index 0.


En esta página del sitio puede ver el video en línea String || String Objects || String methods In JavaScript | JavaScript Course for Beginners de Duración online en buena calidad , que subió el usuario Parnika Tutorials 22 mayo 2023, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 77 veces y le gustó 4 a los espectadores. Disfruta viendo!