0
Cannot seem to figure out what I’m missing if anyone has any input I’ve passed three out of the 5 tests🤷🏽♂️
4 ответов
+ 1
You probably didnt include 18 as adult
If you write age > 18 change to age >= 18
0
Your default code is:
function main() {
var age = parseInt(readLine(),10)
// write code here
}
Why you take one more input from user? You only need 1.
Also you check is 10 smaller than 18, but your task is to check are user is adult, have more than 18, including 18. So You need to compare given age and 18.
0
readLine in node.js are taking user input, sololearn use node.js to test js codes.
About parseInt, and why thay use 10 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
- 1
function main() {
var age1 = parseInt(readLine(), 10)
var age2 = parseInt(readLine(), 18)
console.log(10<18);
}
This is my code.