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:

Compare the Triplets | Javascript | hackerrank.com

07-05-2020 hackerrank.com

File Upload Using Angular Js and Node Js

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

How to convert html to pdf in Node js

12-03-2017 pdf convert html node js

Get next date from given date in javascript

06-03-2017 date javascript next date

Sample Validations in javascript

22-02-2017 validations javascript