Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
trying to make an array getting new values through function, then return it as global
var doc = document;
var k;
var array1 = [];
var select = doc.getElementById("select");
var select = doc.getElementById("select");
var divP   = doc.getElementById("poeng" );
var divH   = doc.getElementById("helse" );
var runder = doc.getElementById("rundeQ");
var form1  = doc.getElementById("form1" );
form1.onsubmit = function(evt){ 
evt.preventDefault()
Window.k = array1.push("yay")
}
console.log(k)

what you are seeing is an attempt to make a global array that adds new values in function, i want to use this value later therefore trying to get that new array value available globally for the next functions aka making it globally. any tips how i can make it work? so the thing is i want to have multiple buttons that all returns thorugh function, to an array globally. then i can use the last value of everytime

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

var doc = document;
var k;
var array1 = [];
var select = doc.getElementById("select");
var select = doc.getElementById("select");
var divP   = doc.getElementById("poeng" );
var divH   = doc.getElementById("helse" );
var runder = doc.getElementById("rundeQ");
var form1  = doc.getElementById("form1" );
form1.onsubmit = function(evt){ 
    evt.preventDefault()
    window.k = array1;
}
console.log(k)

You can use window object for this. Dont use window.k = array1.push(value); Because push() returns length of the result array.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda