Akshay H Mulky
Kilo Guru

Hi Chinmayee,

you can use this:

var newStr = str.replace(str.split(" ").splice(-1), "987c");