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 Loops, Arrays and Objects Tracking Data Using Objects Mixing and Matching Arrays and Objects

ian truong
ian truong
4,685 Points

help fix/finish my code plz.

function makeBooking { var hotel = { booking : 0;, rooms: 50;, costumer; } for (var i = 0; i < 50; i++){ var costumer = prompt:("please type "yes" for a room.") if( costumer === "yes"){ booking+=1;

        }
}

} makeBooking();

3 Answers

Steven Parker
Steven Parker
229,732 Points

Here's a few hints:

  • items in object literals are separated by commas (not semicolons)
  • there should be no colon between "prompt" and the parentheses
  • use a different kind of quotes when quoting a string that contains quotes
  • a variable can't be incremented until it has been assigned a value
ian truong
ian truong
4,685 Points

yes, this helps a alot. thanks! all those errors u pointed out are so obvious. i feel like i am not coding enough i guess. coding is so hard that fact that one syntax can break the entire block of code.

Vasanth Baskaran
Vasanth Baskaran
4,333 Points

That's fine Ian, keep practicing one day you will overcome these mistakes.