Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

266
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda