Wrong output


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-x9DnD/0/2?curriculum_id=506324b3a7dffd00020bf661#

on entering age less than 13 the screen prints the else value which is for age that is greater than 13


confirm("are you ready to play");
var age = prompt ("what is your age");
if("age" < 13)
{
    console.log ("they're allowed to play but we take no responsibility")
    }
    else {
        console.log ("play on!")
        }


#2

In your if condition, you put quotation marks around age and turned it into a string. Try removing them.


#3

thanx it worked :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.