Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

264
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!