es6 · ES6 Basics
ES6 gives you a number of new methods for operating with Strings. Which one replaces this annoying piece of code?
let some_text = "some string";
if(some_text.indexOf('str') !=-1){
return true;
}Answers
- some_text.repeat('str');
- some_text.endsWith('str');
- some_text.includes('str');