If we want to remove last two characters from given string. There is an simple method in javascript, i.e substring.
var name = "hi hellow"; name.substring(0, name.length - 2);
the result is : hi hell
Note: The substring() method does not change the original string.
The actual substring syntx is
string.substring(start, end)
You might also like:
Time Sorting Ascending or Descending Order in Javascript19-07-2017 Javascript ascending order descending order |
Example for Conditional Operator in php16-04-2017 php Conditional Operator example |
Filter for insert HTML in Angular Js06-03-2017 filter show html angular js html |
Email validation regular expression in javascript22-02-2017 email validation regex |
Send Mail in Node Js21-02-2017 node js mail npm module |