VISUAL STUDIO CODE CONSOLE

When I run these simple lines of beginner code
the console does not display the contents of the array it only lists them

var listaDeEstudiantes;
listaDeEstudiantes = [[“Nora”, 97], [“Gino”, 78]];
console.log(listaDeEstudiantes);

(2) [Array(2), Array(2)]

Arreglos Anidados.js:3

No hay ningún depurador disponible; no se puede enviar “variables”.

Welcome to our community!

The code works fine. But you have to change the double quotes characters in your code snippet. They are not valid. Use single ' or double quotes ":

1 Like

It depends on the console. For example, the browser will compact it to a “twirlable” array so you have to twirl it open to see the nested arrays.

You can always use JSON.stringify for the log.

console.log(JSON.stringify(listaDeEstudiantes, null, 2));

If you run the code using Node.js it should print the arrays.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.