RosettaCodeData/Task/Substring-Top-and-tail/JavaScript/substring-top-and-tail.js

4 lines
185 B
JavaScript
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
alert("knight".slice(1)); // strip first character
alert("socks".slice(0, -1)); // strip last character
alert("brooms".slice(1, -1)); // strip both first and last characters