JavaScript Program to Convert the Given Character to Unicode and vice versa

Write a JavaScript program to convert the given character to unicode and vice versa.

Source Code
<title>Convert the Given Character to Unicode and vice versa</title>
    function convert()
        var c = document.getElementById("input1");
        var u = document.getElementById("input2");

        if(c.value != "")
            u.value = c.value.charCodeAt();
            c.value = String.fromCharCode(u.value);
<p>Enter either Character or Unicode and click on CONVERT</p>
Character <input type="text" id="input1"/><br/>
Unicode <input type="text" id="input2"/><br/>
<input type="button" value="CONVERT" onclick="convert()"/>