New We are sorting MAX channels into categories and territories. Read the news

Замена вхождения строки



Метод String.re­placeAll() позволяет найти все вхождения заданной подстроку и заменить их на что-то другое:

const storyText = 'I know not where I was born, save that the castle was' +
    ' infinitely old and infinitely horrible.';
const changedStory = storyText.replaceAll('infinitely', 'somewhat');
console.log(changedStory); // I know not where I was born, save that the castle was somewhat old and somewhat horrible3.
Views: 11
Open in MAX Report an inaccuracy

Report an inaccuracy

Describe what needs fixing. If you have a source, add a link.

You are leaving datool.ru

The link leads to an external website. datool.ru is not responsible for its content — check the address before entering passwords or payment details.

Redirecting in 10 s

Go