JavaScript Program to Display Full Name of User

Write a JavaScript program to display full name of user.



Source Code
<html>
<head>
    <title>String join() method example</title>
    <script>
        function display()
        {
            var panel = document.getElementById("panel");
            var fname = document.getElementById("first").value;
            var lname = document.getElementById("last").value;
            var fullName = fname.concat(lname);
            alert("Hello, " + fullName);
        }
    </script>
</head>
<body>
<form method="get" action="#">
First name <input type="text" id="first"/><br/>
Last name <input type="text" id="last"/><br/>
<input type="button" value="Submit" onclick="display()"/>
</form>
<p id="panel"></p>
</body>
</html>
Output