This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.
Smartphone icons created by Freepik - Flaticon
Extract a part of a string counting from the end:
let text = "Apple, Banana, Kiwi"; let part = text.slice(-12); document.getElementById("demo").innerHTML = part;
Because the slice starts at a specified spot in the string and goes to the end position (
) it always goes from left to right. If an end position is not specified, the selection is to the end of the string.