Skip to content

Instantly share code, notes, and snippets.

@ShannonPaige
Forked from stevekinney/1510-function-cfus.md
Last active March 30, 2016 17:31

Revisions

  1. ShannonPaige revised this gist Mar 30, 2016. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion 1510-function-cfus.md
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,22 @@
    # JavaScript Functions

    I can explain the difference between function declarations and function expressions.
    Yes. Declarations can get used higher than they are written, expressions can't.

    I can explain what the value of `this` is in a normal function.
    Global window

    I can explain what the value of `this` is when called from the context of an object.
    The object

    I can explain how to explicitly set the value of `this` in a function.
    .call(this, arguments) or .apply(this, [arguments])

    I can explain the difference between `call` and `apply`.
    They allow you to explicitly define this, the only difference is that aaply takes other arguments as an array whereas call doesn't need the arguments to be in an array.

    I can describe an case where I might need to use `bind` to avoid polluting the global scope.
    Yes, when something is asyn, or calling a function from a constructor, you may need to bind the 'this'

    I can explain how `bind` works.
    I can explain how `bind` works.
    Passing a function and the context of this.
  2. @stevekinney stevekinney created this gist Mar 30, 2016.
    15 changes: 15 additions & 0 deletions 1510-function-cfus.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # JavaScript Functions

    I can explain the difference between function declarations and function expressions.

    I can explain what the value of `this` is in a normal function.

    I can explain what the value of `this` is when called from the context of an object.

    I can explain how to explicitly set the value of `this` in a function.

    I can explain the difference between `call` and `apply`.

    I can describe an case where I might need to use `bind` to avoid polluting the global scope.

    I can explain how `bind` works.