erasing last letter of word javascript code example Example: how to remove last three letters of word in js str = str.slice(0, -3);