Bummer! That Track couldn't be located. Perhaps one of the Tracks below is what you're looking for?

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

javascript syntax

not sure why this simple code isnt working? any ideas

$(document).ready(function() {
  confirm("Are you ready to play!")
  var name = prompt("What's your name?")
        if (name == "hyo") {
            console.log("hey corgi lover");

        } else if(name == "josh" ) {
            console.log("hey kungfu king");

        } else {
            console.log("hey lets play");
        }
});

2 Answers

Did you import jQuery library? $(document).ready() is jQuery thing. I ran the rest of the function in plain JS and it did work fine.

i thought i did but i guess i didnt do it right. thank you!