JavaScript implementation of Perl’s Chop

/ Published in: JavaScript
Save to your folder(s)

Simply removes the last character from a string.

Copy this code and paste it in your HTML
  1. String.prototype.chop = function() {
  2. return this.substring(0, this.length - 1);
  3. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.