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 trialCraig Britton
Full Stack JavaScript Techdegree Student 2,690 PointsHello, Question: Syntax structure?
Will the the line #2 below cause/ will cause problems in other project if used this way?
By adding the .toLowerCase() to end of the search value.
1. const inStock = ['pizza', 'cookies', 'eggs', 'apples', 'milk', 'cheese', 'bread', 'lettuce', 'carrots', 'broccoli', 'potatoes', 'crackers', 'onions', 'tofu', 'limes', 'cucumbers'];
2. const search = prompt('Search for a product.').toLowerCase();
3. let message;
Seems to be working fine with this lessonπ.
1 Answer
Robert Manolis
Treehouse Guest TeacherHey Craig Britton , the toLowerCase() method is specifically a string method. So you should be able to successfully chain it to any string.
Here's a helpful link with more info on that method.