Consider following code snippet:
var str = 'MyTestingString';
console.log(str.slice(2,8), str.substr(2,8), str.substring(2,8));
What will be printed to the console?
Explanation
The slice() method extracts parts of a string and returns the extracted parts in a new string. slice() extracts up to but not including endSlice. str.slice(1, 4) extracts the second character through the fourth character (characters indexed 1, 2, and 3).
var str = 'MyTestingString';
console.log(str.slice(2,8)); // Testin
The substr() method returns the characters in a string beginning at the specified location through the specified number of characters. The substring() method returns a subset of a string between one index and another, or through the end of the string (similar to slice method).

Thanks @xalexvp02 ! fixed

2018 Feb 4, 5:36:09 PM

Consider following code snippet: var str = 'MyTestingString'; console.log(str.slice(2,8), // Testin Explanation: var str = 'MyTestingString'; console.log(str.slice(2,8)); // Testing !??

2018 Jan 21, 9:47:06 PM

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести