native javascript last 3 character remove string in for loop code example Example: remove last 3 characters from string javascript str = str.slice(0, -3);