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 trialAmy Tomey
12,847 Pointsmy prompt comes up perfectly, then i get an error... i can't see what I'm missing.
When i input anything into the prompt, nothing happens. I get the following error on the console: Uncaught ReferenceError: documant is not defined at search-list.js:11 here is my code: const inStock = ['pizza', 'cookies', 'eggs', 'apples', 'milk', 'cheese', 'bread', 'lettuce', 'carrots', 'broccoli', 'potatoes', 'crackers', 'onions', 'tofu', 'limes', 'cucumbers'];
const search = prompt('Search for a product.'); let message;
if (inStock.includes(search)) {
message = Yes, we have <strong>${search}</strong>.
;
} else {
message = Sorry, we do not have <strong>${search}</strong>.
;
}
documant.querySelector('main').innerHTML = <p>${message}</p>
;
2 Answers
John Piaz
1,713 PointsJust use the JavaScript code I put inside the "<script>" tags
Amy Tomey
12,847 PointsThank you for the HTML answer, but I am working on a javascript challenge. I apologize for not making my question more specific.
John Piaz
1,713 PointsJohn Piaz
1,713 PointsYou made several syntax mistakes.
Here is the full HTML code for what you want: