What is wrong? Error on test. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
2nd Feb 2023, 6:40 PM
Сергей Безкоровайный
Сергей Безкоровайный - avatar
6 Answers
+ 3
Could you please describe what the code is supposed to do? According to the error message, we can't use prompt() in the node.js script. If it is a sololearn code task, use the given code to get input.
2nd Feb 2023, 7:16 PM
Lisa
Lisa - avatar
+ 2
Worked. Thx for all) Prompt - is a title of function: const prompt = (function() { const lines = require('fs').readFileSync(0, 'utf8').split('\n') return function() { if (lines.length > 0) return lines.shift() const error = Error('EOF when reading a line') error.name = 'EOFError' throw error } })()
2nd Feb 2023, 9:22 PM
Сергей Безкоровайный
Сергей Безкоровайный - avatar
+ 1
prompt function doesn't works in Node js use readLine function
2nd Feb 2023, 7:17 PM
A͢J
A͢J - avatar
+ 1
let x = Number(prompt()) let y = Number(prompt()) let a = '' for(x; x <= y; x++){ if (Number.isInteger(Math.sqrt(x))){ a = a + " " + x } } console.log(a)
2nd Feb 2023, 9:19 PM
Сергей Безкоровайный
Сергей Безкоровайный - avatar
0
Use Web playground's JavaScript tab for running JS code..
2nd Feb 2023, 7:17 PM
Jayakrishna 🇮🇳
0
This is a task from another course. Machine translate: "Input data Integers a and b are entered. It is guaranteed that a does not exceed b. Output Print all numbers on the segment from a to b that are perfect squares. If there are no such numbers, then nothing needs to be output."
2nd Feb 2023, 8:24 PM
Сергей Безкоровайный
Сергей Безкоровайный - avatar