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

Popular posts from this blog

monitor web browser programmatically in Android? -

ios - iPhone/iPad different view orientations in different views , and apple approval process -

Shrink a YouTube video to responsive width -