JavaScript code in Replit fails to convert user input to lowercase using toLowerCase(), prompts are not recognized, and a new console message disrupts code readability

Problem Description: The code designed to convert user input string to lowercase using toLowerCase() is not yielding the expected result.

Expected Behavior: The code should receive user input, perform a conversion to lowercase, and subsequently log the converted lowercase string in the console.

Actual Behavior: Instead of performing the expected lowercase conversion, the code appears to echo the original input. Additionally, the prompt function is not recognized, resulting in a ReferenceError: prompt is not defined error for every code execution.

Additional Issue: Upon running the code, an unexpected and potentially distracting console message is displayed:  /nix/store/0g3sc6fhnhsxx8d837kyj06qcbjind1b-nodejs-18.16.1/bin/node $file. This message was not previously present and affects code readability.

Steps to Reproduce:

  1. Execute the provided code.
  2. Input a string as prompted.
  3. Observe the output in the console, including the ReferenceError: prompt is not defined error.

Bug Occurs at This Link: (https://replit.com/@MUHAMMADHASS124/error#index.js)

Browser: Google Chrome

Operating System: Windows 10 Pro

Device (Android, iOS, NA Leave Blank): [Specify your device if applicable, otherwise, leave it blank.]

Desktop App Version (Avatar Menu → “Version”) or NA: [Specify the desktop app version if applicable, otherwise, write NA if not using the desktop app.]

Replit Plan: Free

Hi @MUHAMMADHASS124 , welcome to the forums!
I can fix this issue:

In the .replit file, add this line at the top: run = “clear && node index.js
As for the other error, I have no idea why it is happening. Can you try using the old Node.js template instead of the Beta version?

1 Like