12 Matching Annotations
  1. Mar 2020
    1. HTML

      This should say "JSON".

    2. scene_3 and view_69

      These keys don't seem to agree with the image.

    3. object_12

      I believe this should say object_1 in order to match the image.

  2. Nov 2018
    1. map

      The map operation is a classic example) of functional thinking. Here, the JavaScript map function takes an array of words (produced by the expression str.split(" ")), and returns a new array by applying a function (bound to the argument fn) to each element of the input array. The join function then converts the new array to a single string, with a space character between the elements.

    2. fn

      When this function processWords is called, the first argument should be a function. processWords will pass that argument fn on to the built-in JavaScript function map.

    3. capify

      capify is a function. It is being passed as an argument to the function processWords.

    4. treat functions as first-class objects

      This means that functions can be assigned to variables, passed as arguments to other functions, and returned from other functions. In many ways it means treating functions just like any other type of data: numbers, strings, etc. Many programming languages do not have this flexibility.

    5. }());

      This entire code listing is a self-invoking function. In other words, the code defines an anonymous function (it has no name), follows the definition with (), which turns it into a call to the anonymous function, and wraps the whole thing in parentheses so that JavaScript will process it that way. This is a way of keeping things to a local rather than global scope without the need to name and call a function. Learn more.

    6. written to an object-oriented standard

      Notice that this is the old-school JavaScript syntax for object-oriented code, dealing directly with prototypes. This differs from our metatypic approach to JavaScript syntax, which hides prototype details under more familiar class concepts.

    7. the whole thing relies on a context that may or may not exist

      In other words, the JavaScript code might not be running in a Web browser, or the browser's page might not contain a button with the id of main_button.

    8. document object model (DOM)

      The DOM is an object-oriented data model of the browser's current HTML page contents. It provides an interface for JavaScript code to manipulate the browser page. Learn more.

    9. function getText

      Notice that these functions are defined at global scope. They are not methods inside of a class definition.