220 Matching Annotations
  1. May 2018
    1. In AngularJS, the view is a projection of the model through the HTML template

      Definition of 'VIEW' in AngularJS terms

    2. Once an application is bootstrapped, it will then wait for incoming browser events (such as mouse clicks, key presses or incoming HTTP responses) that might change the model. Once such an event occurs, AngularJS detects if it caused any model changes and if changes are found, AngularJS will reflect them in the view by updating all of the affected bindings

      This is probably the famous digest cycle that is triggered automatically on changes detected.

    1. The first item will have one unit of space against the container edge, but two units of space between the next item because that next item has its own spacing that applies

      This explains how the extra space is divided/distributed

    2. By default, flex items will all try to fit onto one line. You can change that and allow the items to wrap as needed with this property.

      if not wrapped and not enough space in the container, there will be an overflow on the container (handle it with 'overflow' CSS property to determine if things should be visible is not enough space, scroll exists or not, etc...)

    1. This behavior also argues for following the convention of placing an opening curly brace at the end of a line in JavaScript, rather than on the beginning of a new line. As shown here, this becomes more than just a stylistic preference in JavaScript.

      I was on the righteous side all those years! Yey!

    2. automatically inserted

      Read all about it here

    3. although omitting them is generally really bad form

      and that's a good example/reason why to always us semicolons

  2. developer.mozilla.org developer.mozilla.org
    1. To avoid this problem (to prevent ASI), you could use parentheses

      nice work around to the ASI done by JS, if you need new lines on the return statement

    2. No line terminator is allowed between the return keyword and the expression

      important!

    1. Now that’s a really powerful JavaScript pattern that you have learned. It combines the power of both IIFEs and closures.This is a very basic variation on the module pattern. There are more patterns, but almost all of them use an IIFE to create a private closure scope.

      summary of the importance of the IIFE + closures, to create the module pattern

    2. Remember this! You need a function expression to form an IIFE. Function statements/definitions are never used for creating IIFEs

      key point, but if you've read above it, that's not a surprise

    3. The above stylistic variation can be used by replacing “!” with “+”, “-”, or even “~” as well. Basically any unary operator can be used

      examples of operators that can be used for the evaluation of the function declaration as an expression. Also, wrapping the entire statement with parenthesis (meaning: (function() {...}()); ) will also do the same trick

    4. As we saw before, a function statement always starts with the function keyword. Whenever JavaScript sees function keyword as the first word in a valid statement, it expects that a function definition is going to take place. So to stop this from happening, we are prefixing “!” in-front of the function keyword on line 1. This basically enforces JavaScript to treat whatever that’s coming after “!” as an expression.

      Why they used the '!' in the beginning of the statement

    5. So the difference here is that the function expression has a name “fibonacci” that can be used inside that function expression to call itself recursively

      cool tip: named function expression is useful if the function expression needs to be called from within itself - such as in the case of recursion

    6. They are anonymous because they don’t have a name following the function keyword

      definition of an anonymous function

    1. // use Array.isArray or Object.prototype.toString.call // to differentiate regular objects from arrays

      .

    1. The __proto__ of an object created by calling a function with new is equal to the prototype of that function The __proto__ of a function’s prototype is equal to Object.prototype The __proto__ of Object.prototype is null

      Key points in understanding OO & inheritance in JS

    1. ng-repeat="message in emails.messages"

      declerative HTML

    2. inside Controllers or as a defined method. Here’s the method usage,

      he probably means not the usage of a defined filter, but using the filters feature, which requires defining as a method that is used later.

    3. There are various ways to define Directives in the DOM, these could look like so

      in short:

      • as an attribute
      • custom element
      • css class
      • as html comment