Why isn't this function displaying cookie? : I have set the cookie using **document.cookie** but I can't read it. I read on w3schools that you can read it by document.cookie, but it's not working. Maybe I've misunderstood this thing, or maybe I'm trying something wrong, I don't know. What's wrong in following code?
Here's my code:

    <body>
    <button onclick="one()">Set</button>
    <button onclick="two()">Read</button>
    
    <script>
    function one()
    {
    	document.cookie="user=Vikas; expires=Sun, 18 Dec 2016 12:00:00 UTC";
    	var r= document.cookie;
    	return r;
    }
    function two()
    {
    	var h = one();
    	var i= h.split(";");
    	var j= i[0];
    	alert(j);
    }
    
    </script>
    </body>