Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

shannon sivertsen
shannon sivertsen
8,250 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;
  ul.removeChild(li);
}

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

Thanks!

2 Answers

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

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.