javascript substring

JavaScript
// the substring method returns a string out of another string

const str = 'Mozilla';

console.log(str.substring(1, 3));
// expected output: "oz"

console.log(str.substring(2));
// expected output: "zilla"
const str = 'substr';

console.log(str.substr(1, 2)); // (1, 2): ub
console.log(str.substr(1)); // (1): ubstr

/* Percorrendo de trás para frente */
console.log(str.substr(-3, 2)); // (-3, 2): st
console.log(str.substr(-3)); // (-3): str
var str = "Hello world That is reallly neat!";
var res = str.substring(0, 5);//get first 5 charsvar str = "Hello world!";
var res = str.substring(1, 4); //ell// zero-based index, 'end' is excluded from result
myString.substring( start, end ) string.substring( start, end )
Source

Also in JavaScript: