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

When defining "editing" why using these spaces?

In video the instructor writes like this:

ng-click=" editing = !editing "

when these also work:

ng-click="editing = !editing"

and even

ng-click="editing=!editing"

Is there some common practise when writing these kinds in Angular?

At the same time in javascript normally you would see not equal as != and not other way around =!. This confuses me a bit.

1 Answer

Nicholas Grenwalt
Nicholas Grenwalt
46,626 Points

You always want to write code that is easier to understand. Each way you've provided the code will work, but with spacing it makes things a lot easier on the eyes so generally developers will lean towards the second way. It makes for a much cleaner presentation when you have to show and explain code as well.