Sean Robertson

Sean Robertson


26 Built-in String Methods in JavaScript πŸš€

In this video, we will take a look at 26 different built-in string methods in JavaScript. πŸ’»

⏱ Timestamps ⏱
πŸ“Œ Intro (0:00)
πŸ“Œ charAt (0:23)
πŸ“Œ charCodeAt (1:07)
πŸ“Œ concat (1:44)
πŸ“Œ endsWith (2:51)
πŸ“Œ fromCharCode (4:01)
πŸ“Œ includes (5:10)
πŸ“Œ indexOf (6:19)
πŸ“Œ lastIndexOf (7:42)
πŸ“Œ match (8:44)
πŸ“Œ matchAll (10:19)
πŸ“Œ normalize (12:40)
πŸ“Œ padEnd (13:33)
πŸ“Œ padStart (14:41)
πŸ“Œ repeat (15:18)
πŸ“Œ replace (16:09)
πŸ“Œ replaceAll (17:32)
πŸ“Œ search (18:36)
πŸ“Œ slice (19:38)
πŸ“Œ split (20:33)
πŸ“Œ startsWith (21:21)
πŸ“Œ substring (22:08)
πŸ“Œ toLowerCase (22:59)
πŸ“Œ toUpperCase (23:35)
πŸ“Œ trim (24:05)
πŸ“Œ trimEnd (24:33)
πŸ“Œ trimStart (25:06)

#javascript #developer

What is GEEK

Buddha Community

26 Built-in String Methods in JavaScript πŸš€
Lowa Alice

Lowa Alice


JavaScript Strings Tutorial

JavaScript Strings

πŸ“Ί The video in this post was made by Programming with Mosh
The origin of the article:
πŸ”₯ If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free β€˜GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#javascript #strings #javascript strings #javascript strings tutorial

Lawson  Wehner

Lawson Wehner


String replaceAll() method in JavaScript

String replaceAll() method in JavaScript

The replaceAll() method replaces all occurrences of the search string with the replacement text and returns a new string. This method does not change the original string.

Like the replace() method, you can pass a string or a regular expression as a search pattern. The replacement can be a string or a function called for each match.

const str = 'Mr. Red owns a red bike and a red car.'
const newStr = str.replaceAll(/red/gi, 'blue')

// Mr. blue owns a blue bike and a blue car.

Note that A RegExp without the global (g) modifier will throw a TypeError: "replaceAll must be called with a global RegExp".

The replaceAll() method also accepts a function (instead of a string) as the second parameter:

const str = 'Mr. Red owns a red bike and a red car.'
const newStr = str.replace(/red/gi, match => {
  return match.toLowerCase()

// Mr. red owns a red bike and a red car.

Original article source at:

#javascript #string #method 

Condo Mark

Condo Mark


Top 10 JavaScript String Methods You Should Know


String methods in JavaScript help you to work with strings, mastering those methods is a good idea, because a lot of times you will find yourself working with strings in your JavaScript program or application, So you will need to know those methods. That’s why in this article I decided to show you 10 useful string methods that maybe you didn’t know some of them.

Javascript Code.

Photo by Irvan Smith on Unsplash

1. String Length

The **length** property returns the length of a string. Take a look at the example below:

Length Method.

The Length method.

2. Searching for a String

You can search for a string inside another string using the search method, It will return the position of that string. Have a look at the example below:

The Search Method in Javascript.

The Search method.

#javascript #web-development #javascript-string #javascript-tips

Madilyn  Kihn

Madilyn Kihn


Convert String To Array Using Javascript Split Method

The easiest approach to use javascript built-in method String.split().

#javascript #javascript string #string to array #morioh #array

Monty  Boehm

Monty Boehm


How to Use The LastindexOf() Method for Strings & Arrays In JavaScript

JavaScript lastIndexOf() method explained with examples

The JavaScript lastIndexOf() method is a method of JavaScript String and Array prototype objects.

The function is used to return the index (position) of the last occurrence of the given argument.

The index of both JavaScript strings and arrays start from 0, and here are some examples of using the lastIndexOf() method:

// A string
let aString = "Good morning! It's a great morning to learn programming.";
let index = aString.lastIndexOf("morning");

console.log(index); // 27

// An array
let anArray = ["day", "night", "dawn", "day"];
let valueIndex = anArray.lastIndexOf("day");

console.log(valueIndex); // 3

As you can see from the examples above, the lastIndexOf() method is available for string and array type values in JavaScript.

When the value you search for is not found in the string or array, the method will return -1:

let aString = "Nathan Sebhastian";
let index = aString.lastIndexOf("morning");

console.log(index); // -1

let anArray = ["day", "night", "dawn", "day"];
let valueIndex = anArray.lastIndexOf("dusk");

console.log(valueIndex); // -1

The lastIndexOf() method is also case sensitive, so you need to have the letter case in the argument match the actual string.

The above example returns -1 because Nathan is different from nathan:

let aString = "Nathan Sebhastian";
let index = aString.lastIndexOf("nathan");

console.log(index); // -1

The lastIndexOf() method will search your string or array backward.

This means the method will look for matching values from the last element and ends with the first element.

Finally, the method also accepts a second parameter to define the start position of the search.

The following example shows how to start the lastIndexOf() search at index 4:

let aString = "Hello World!";
let index = aString.lastIndexOf("World", 4);

console.log(index); // -1

Because a second argument 4 is passed to the lastIndexOf() method, JavaScript will search the value from index 4 to index 0 only.

While the World string is available inside the aString variable, the index starts at 6. Since it’s outside the search range of the lastIndexOf() method, the value is not found and -1 is returned.

The same rule applies when you search for a value in an array:

let anArray = [8, 3, 4, 8, 2];
let index = anArray.lastIndexOf(8, 2);

console.log(index); // 0

In the abov example, the lastIndexOf() method returns 0 for the index of the value 8.

This is because the second argument 2 makes the method search from index 2 only. Since the last index of the value(8) is 3, it stays outside of the method search range.

And that’s how the lastIndexOf() method works in JavaScript. πŸ˜‰

Original article source at:

#javascript #method #strings