Remove last two characters from given string


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:

Functions in javascript

25-05-2018 functions javascript es5 es6 arrow functions named functions Closures Nested Functions Callbacks Arrow functions.

Time Sorting Ascending or Descending Order in Javascript

19-07-2017 Javascript ascending order descending order

How to redirect one page to another page in php

20-03-2017 redirect php

How to upload file by using request module

18-03-2017 request module node js

Filters for convert text to camel case in Angular Js

05-03-2017 angularjs camelcase filters