JavaScript DOM
I have an error and I don't know how to fix it, This is my JavaScript code: var codigo = Math.round(Math.random()*(9999-1000)+parseInt(1000)); intentos = 0; console.log(codigo); var formulario = document.getElementById("form"); var getValue = function(){ var x = document.getElementById("numero").value; var aciertos = 0, coincidencias = 0; if (propuesta != codigo) { intentos = intentos + 1; for (var i in codigo.length){ if (propuesta.charAt(i) == codigo.charAt(i)){ aciertos = aciertos + 1; } else if (propuesta.charAt(i) in codigo){ coincidencias = coincidencias + 1 } } alert("Successes: " + aciertos + " Coincidences: " + coincidencias); alert("propon otro numero"); } }; In the HTML document I have a form with an input and a send button but as soon as the form is sent it saves the value of the variable and it is automatically deleted, how do I for not delete it?