javascript - Get last word js -
this removes last word. how last word (stripe)?
var baseshirturl = "base shirt draped fabric stripe"; baseshirturl = baseshirturl.substring(0, baseshirturl.lastindexof(" ")); alert(baseshirturl);
to last word:
baseshirturl.split(' ').pop();
and remove last word can this:
baseshirturl = baseshirturl.replace(/\w+$/,'');
Comments
Post a Comment