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:

File Upload Using Angular Js and Node Js

28-05-2018 AngularJs Node js file upload multer module

How to submit form using javascript or jquery.

16-04-2017 javascript jquery submit form

How to make an http request in node js

14-03-2017 http module node js

Remove last two characters from given string

06-03-2017 substring javascript remove

How to find Angular Errors

06-03-2017 errors angularjs exceptionHandler