+ 1
Comparison operators 2 JavaScript
I have no idea how to solve this at this point, tried multiple things. Not sure if I’m going in the right direction, Can someone help please? Issue: You are given a program that takes the age of the user as input. Complete the code to check if the user is an adult, and output to the console the corresponding boolean value. function main() { var age = parseInt(readLine(), 10) // Your code here if (age >= 18) { return true; } else { return false; } } console.log(main())
2 Antworten
0
if this is a sololearn course pratice task, the main function is called by test cases...
so you doesn't need to call it yourself, and you rather must console.log() from inside the main() function ;)
0
function main() {
var age = parseInt(readLine(), 10)
// Your code here
// let age = 20
if (age >= 18){
console.log(true);
}else {
console.log(false);
}
}