Cannot seem to figure out what I’m missing if anyone has any input I’ve passed three out of the 5 tests🤷🏽‍♂️ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Cannot seem to figure out what I’m missing if anyone has any input I’ve passed three out of the 5 tests🤷🏽‍♂️

https://sololearn.com/coach/392/?ref=app

26th Nov 2021, 10:09 PM
Alex
4 Answers
+ 1
You probably didnt include 18 as adult If you write age > 18 change to age >= 18
26th Nov 2021, 11:39 PM
PanicS
PanicS - avatar
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.
27th Nov 2021, 9:45 AM
PanicS
PanicS - avatar
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
27th Nov 2021, 9:48 AM
PanicS
PanicS - avatar
- 1
function main() { var age1 = parseInt(readLine(), 10) var age2 = parseInt(readLine(), 18) console.log(10<18); } This is my code.
26th Nov 2021, 11:41 PM
Alex