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 trialja5on
10,338 PointsMy use of .toLowerCase() I get no errors but would this be proper use
https://w.trhou.se/ka54gqbjsp
Hello could someone please check my use of toLowerCase() at line 23 & line 24.
1 Answer
Jassim Alhatem
20,883 PointsYes, it's perfectly fine. As a matter of fact, using .toLowerCase() in conditional statements is preferable (to me) when comparing strings. For example:
var name = "Jassim";
if(name === "jassim"){
console.log("won't work");
}
var name = "Jassim";
if(name.toLowerCase() === "jassim"){
console.log("will work");
}
I know I stretched my answer, but I hope it helps.