> "hey there".split(" ") "hey"
HTML example code:
You need to split the string by space and get only 0 index values.
<!DOCTYPE HTML> <html> <body> <script> var str = "Hello world!"; var res = str.split(' '); console.log(res); </script> </body> </html>
Do comment if you have any doubts and suggestions on this JS string topic.
Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.