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 trialFarai Tanekha
10,669 PointsIndentation & differentiating between regular function and arrow function
Great presentation! I just thought there were 2 things that could be added to make it better:
- Include indentation withing the function body
- Make clear the difference between a regular anonymous function vs an (anonymous) arrow function, as some beginners watching the video may not be aware of this.
For example:
-
Anonymous regular function (declaration):
function (){ \s console.log("I am an anonymous function with clear indentation in my function body.") }
-
Arrow function
()=> { \s console.log("I am an arrow function with clear indentation in my function body.") }
Please, note that I have used the JS metacharacter \s to indicate space/ indentation as I couldn't find the right markdown for it.
1 Answer
Steven Parker
231,275 PointsHe had to insert new lines from the bottom to prevent the editor from auto-indenting!
And spaces are not collapsed inside a Markdown code section. So you can just put the actual number of spaces that you want displayed.
For example:
<-- two spaces
<-- eight spaces