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 Get Your Blogs Posts Using Blogger API

30-07-2017 blogger api json php

How to submit form using javascript or jquery.

16-04-2017 javascript jquery submit form

Example for Conditional Operator in php

16-04-2017 php Conditional Operator example

How to use http-post request in node js

14-03-2017 http-post module node js

Send Mail in Node Js

21-02-2017 node js mail npm module