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

268
Visualizações
Developing JavaScript on Windows with VS Code: how to handle prompt?

I am developing JS on a Windows machine using VS Code as my code editor. I have a fairly simple script that I worked on for the Odin Project:

let userInput = parseInt(prompt("Please enter the number you would like to FizzBuzz up to: "));

function makeNumberList(userInput) {
    let numberList = []
    for (let i = 0; i <= +userInput; i++) {
        numberList.push(i)
    }
    return numberList
}

function fizzbuzz(number) {
    if (!(number % 3)) {
        if (!(number % 5)) {
            return 'fizzbuzz'
        } else {
            return 'fizz'
        }
    } else if (!(number % 5)) {
        return 'buzz'
    } else {
        return number
    }
}

let numberList = makeNumberList(userInput)
console.log(numberList)
console.log(numberList.map(fizzbuzz))

I can execute that code in a browser by creating an index.html and inserting the code in a <script></script> html tag.

However, I can't get it to work in VS Code. I would like to be able to debug my code seamlessly on VS Code as it was executing in a brower.

I have stumbled across answers suggesting to use Node and different packages (readline, prompt, prompt-sync) - but that does not work on my side, I can't enter an input - as well as answers stating that Windows does not feature a proper prompt and I should therefore use the Windows Subsystem Linux (WSL).

How can one use VS Code on a Windows machine to debug a JS script requiring user input in a prompt?

about 4 years ago · Juan Pablo Isaza
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