Problem Statement
given a string, remove last character from the string
Solution
to remove last character from the given string in JavaScript, use String.substr() method. substr() method can take index, and length of substring as arguments, and returns the substring from the specified index for the given length. provide the length of substring, such that the last character is not included
str.substr(0, str.length - 1)
Program
remove last character from the string str
let str = 'helloworld';
let output = str.substr(0, str.length - 1);
console.log(output);