I would like to know how can I remove the last word in the string using JavaScript?
For example, the string is \"I want to remove the last word.\"
After usin
The shortest answer to this question would be as below,
var str="I want to remove the last word".split(' '); var lastword=str.pop(); console.log(str.join(' '));