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
melissa brown
4,670 Pointsjavascript 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
akak
29,446 PointsDid you import jQuery library? $(document).ready() is jQuery thing. I ran the rest of the function in plain JS and it did work fine.
melissa brown
4,670 Pointsi thought i did but i guess i didnt do it right. thank you!