Contact: aviboots(AT)netvision.net.il
31,166 questions
40,722 answers
573 users
function get_last_word(s) { var arr = s.split(" "); return arr[arr.length - 1]; } var s = "javascript php c c++ python"; document.write(get_last_word(s)); /* run: python */
var s = "javascript php c c++ python"; document.write(s.split(" ").splice(-1)); /* run: python */
var s = "javascript php c c++ python"; document.write(s.split(" ").pop()); /* run: python */
var s = "javascript php c c++ python"; document.write(s.slice(s.lastIndexOf(' ') + 1)); /* run: python */