Remove last two characters from given string

substring
javascript
remove

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:

Convert and download html to pdf without saving file

28-10-2018 node js convert html to pdf pdf download pdf without saving

Convert Time 24 hrs to 12 hrs format In javascript

12-03-2017 date javascript 12hrs convert

Filter for replace text in Angular Js

05-03-2017 filter replace angular js

Filters for convert text to camel case in Angular Js

05-03-2017 angularjs camelcase filters

How to remove last / value from url in javascript

27-02-2017 array javascript last value