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

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.