Write a javascript program that asks the user to enter his or her first name and then last name, and then
constructs, stores, and displays a third string consisting of the user’s last name followed by a comma, a
space, and first name. Use string objects and methods from the string header file. A sample run could
look like this:
Enter your first name: Paul
Enter your last name: Smith
Here’s the information in a single string: Smith, Paul
var firstName=prompt("Enter your first name: ")
var lastName=prompt("Enter your last name: ")
var fullName=lastName.concat(', ', firstName)
console.log(fullName)
Comments
Leave a comment