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:

How to submit form using javascript or jquery.

16-04-2017 javascript jquery submit form

Using slice remove last two characters from given string

07-03-2017 slice remove

Filter for replace text in Angular Js

05-03-2017 filter replace angular js

How to change background color and color to the text using javascript

27-02-2017 css javascript colors

How to set or update or push the values into Object in javacript

27-02-2017 javascript set update push object