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

Hello, 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
STAFF
Robert Manolis
Treehouse Guest Teacher

Hey 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. :thumbsup: