Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
VSCode automatically formats console.log() output in terminal when logging an array that is longer than 5 elements

I'm trying to log out an array in the terminal but it automatically formats it and adds a new line if the array is longer than 5 elements. How do I make it print normally in a single line.

Example code:

const someArray = [1,2,3,4,5,6,7]
console.log(someArray)

Result: Result of console.log

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

It can be annoying sometimes, this is my solution to fix it when I need to print something line by line.

const someArray = [1, 2, 3, 4, 5, 6, 7, 8];
// The last parameter 4 is for indentation.
console.log(JSON.stringify(someArray, null, 4));
about 4 years ago · Juan Pablo Isaza Relatório

0

This can solve your purpose.

const someArray = [1, 2, 3, 4, 5, 6, 7]
console.log(someArray.join(", "));
about 4 years ago · Juan Pablo Isaza Relatório

0

Simple use JSON.stringify(array);

example :

const array = [2,3,2,23,3,3,5,2,3,4,2,3,4,3,4,2];
console.log(JSON.stringify(array));

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda