Skip to content

Instantly share code, notes, and snippets.

@1337
Created May 26, 2014 20:15
Show Gist options
  • Select an option

  • Save 1337/b0d460eaa9736af992b6 to your computer and use it in GitHub Desktop.

Select an option

Save 1337/b0d460eaa9736af992b6 to your computer and use it in GitHub Desktop.

Revisions

  1. Brian L revised this gist May 26, 2014. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions javascript.js
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,19 @@
    // 1. [ ] how is "foo = function foo" from "foo = function"?
    // 2. [ ] what happens when you do "function foo(foo)"?
    var func = function func(func) {
    // 3. [ ] what happens when you do "var foo" in a "function(foo)"?

    // 3. [ ] what happens when you do "var foo" in a "function(foo)"?
    var func;
    // 4. [ ] what is "typeof func" here?

    // 4. [ ] what is "typeof func" here?
    console.log(typeof func);
    };

    // 5. [ ] what happens if you "function func" after the "var func" above?
    function func(func) {
    console.log("func");
    }

    // 6. [ ] what is this "func" variable?
    // 7. [ ] what is ".call"? -> what does ".call" do?
    // 8. [ ] what is the second "func" (the first argument)?
  2. Brian L created this gist May 26, 2014.
    18 changes: 18 additions & 0 deletions javascript.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    // 1. [ ] how is "foo = function foo" from "foo = function"?
    // 2. [ ] what happens when you do "function foo(foo)"?
    var func = function func(func) {
    // 3. [ ] what happens when you do "var foo" in a "function(foo)"?
    var func;
    // 4. [ ] what is "typeof func" here?
    console.log(typeof func);
    };
    // 5. [ ] what happens if you "function func" after the "var func" above?
    function func(func) {
    console.log("func");
    }
    // 6. [ ] what is this "func" variable?
    // 7. [ ] what is ".call"? -> what does ".call" do?
    // 8. [ ] what is the second "func" (the first argument)?
    // 9. [ ] what arguments do "func" get?
    // 10. [ ] what if you swap ".call" with ".apply"?
    func.call(func, ["func"]);