I'm starting the node studies and I decided to do an exercise in which I need to receive a value n through the node console, which will be the number of elements in an array and receive n elements through the node console. The problem is that I do not know how to get the 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();
});