1
I am starting the studies in Ode and decided to do an exercise in which I need to receive a value n by the Node console that will be the amount of elements of an array and receive n elements by the Node console. The problem is that I don’t know how to receive array elements from the console The code I have so far:
var readline = require('readline');
var valor = 0;
var valor1 = 0;
var conj = [];
var leitor = readline.createInterface({
input: process.stdin,
output: process.stdout
});
leitor.question("Digite a quantidade de itens do conjunto: ",
function(resp,vet){
valor = resp;
for(var i = 0; i<valor; i++){
console.log("Digite o valor de indice "+i);
valor1 = vet;
conj.push(valor1);
}
console.log(conj);
leitor.close();
});
Carlos, lacked you describe your problem or doubt!
– NoobSaibot
i don’t know how to receive the elements of an array through the Node console, I can only receive 1 number
– Carlos Storari