how to remove last world in js code example
Example 1: javascript remove last character from string
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell
Example 2: javascript remove last item
array.pop();
// Example
var colors = ['Yellow', 'Red', 'Blue', 'Green'];
var removedColor = colors.pop(); // Green
console.log(colors); // ['Yellow', 'Red', 'Blue']