how to get last word of string in javascript?
Hi Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 To get last word of string in javascript, use split(" ") method with strArr.length - 1 index value it will return last word from string. You have to only pass " " in split() method. Let鈥檚 see short example to use split(" ") with with text.length - 1 index to get last word from string. let strArr = string.split(" "); strArr[strArr.length - 1]; Today, I鈥檓 going to show you How do I get last word of string in javascript, as above mentioned, I鈥檓 going to use the above-mentioned split() method....