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


shannon sivertsen
shannon sivertsen
8,258 Points

When to use all caps and ' ' vs no ' '

Why is the LI in caps here: const li = createLI(text);

and button is all caps here:

if (e.target.tagName === 'BUTTON') {
  const li = e.target.parentNode;
  const ul = li.parentNode;

I can't get stuck in my head when to use all caps or lowercase. Also when to use ' ' or when not to use ' '


2 Answers

I'm not sure about the capitalization in createLI. But here is what the MDN docs have to say about tagName.

Darrell Conklin
Darrell Conklin
21,940 Points

LI is an acronym for List Item and the CreateLI() function is just following camel casing conventions by capitalizing the first letter of each word but since only the first letter of each word actually appear in the function name you see 2 capital letters consecutively.

When something appears in quotes it's a string and without quotes a variable.