slice without last letter javascript code example
Example 1: javascript remove last character from string
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell
Example 2: js get words first letter
var str = "Java Script Object Notation";
var matches = str.match(/\b(\w)/g); // ['J','S','O','N']
var acronym = matches.join(''); // JSON
console.log(acronym)