JavaScript Program to Split Name Using String's split() Method

Write a JavaScript program to split name using string's split() method.

Source Code
    <title>Manipulating a String</title>
    var name = prompt('Enter ur name');
    var text = name.split(' ');
    document.write('First name: ' + text[0] + "<br/>");
    document.write('Last name: ' + text[1]);

"Coding Hub - Learn to code" app now available on Google Play Store