JavaScript Program to Create (or Set) a Cookie and Read a Created Cookie

Write a JavaScript program to create (or set) a cookie and read a created cookie.

Source Code
    <title>Create and read cookie</title>
        function setCookie() 
            var name = document.getElementById('person').value
            document.cookie = "name=" + name + ";"
            alert("Cookie Created")
        function readCookie() 
            var cookie = document.cookie
            var panel = document.getElementById('panel')

            if(cookie == "")
                panel.innerHTML = "Cookie not found"
                panel.innerHTML = cookie

<form name="myForm">
    Enter your name <input type="text" id="person"/><br/>
    <input type="button" value="Set Cookie" onclick="setCookie()"/>
    <input type="button" value="Read Cookie" onclick="readCookie()"/>
<p id="panel"></p>