//*** length vs indices:"string".substring(2,4); // "ri" (start, end) indices / second value is NOT inclusive"string".substr(2,4); // "ring" (start, length) length is the maximum length to return"string".slice(2,4); // "ri" (start, end) indices / second value is NOT inclusive
//*** watch out for substring swap:"string".substring(3,2); // "r" (swaps the larger and the smaller number)"string".substr(3,2); // "in""string".slice(3,2); // "" (just returns "")
//*** negative second argument:"string".substring(2,-4); // "st" (converts negative numbers to 0, then swaps first and second position)"string".substr(2,-4); // """string".slice(2,-4); // ""
//*** negative first argument:"string".substring(-3); // "string""string".substr(-3); // "ing" (read from end of string)"string".slice(-3); // "ing"
let str = "Hello World"
console.log(str.substring(1, 3)) // el -> Excludes the last indexconsole.log(str.substr(1, 3)) // ell -> Includes the last index