I want to output a random number from JavaScript function that will be saved in cookie and will be called at the end of the application?
  <script>
    document.getElementById("demo").innerHTML = Math.floor(Math.random()*50)*2;
   document.cookie="document.getElementById("demo").value";
</script>
<script>
      var x = document.value;
  document.getElementById("number").innerHTML = "x"
</script>
				
                        
This is from Mozilla Document.cookie docs: