I'm a beginner in Js and have a problem making a little program, I want to put the variables nome, document e Codigo, inside of the JSON array 'registros'
var registros = [];
var codigo = 1;
function salvar() {
var nome = document.getElementById("pNome").innerText;
var documento = document.getElementById("pDocumento").innerText;
var registro = [{
codigo: 0,
nome: "",
sexo: ""
}];
registro.push(codigo, nome, document);
}
registrosbut then tried to push intoregistrowhich is not an array but an object