string first element javascript code example Example: get first word of string js let myStr = "Hello World" let firstWord = myStr.split(" ")[0]