DEV Community

Discussion on: 4 Ways to Remove the Last Character from a String in JavaScript 🚮

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

I'd go with just:

const noLast = book=>book.split(/.$/)[0]
Enter fullscreen mode Exit fullscreen mode

Short and sweet 😊 - I also switched to . since we want to remove the last character (whatever it is)

Collapse
 
trevorzylks profile image
Trevor

A beautiful solution, friend!