-
-
Save DominicTremblay/3e23574cdd056bbe0b2557aa7fe9b010 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sum(x, y) { | |
return (x + y); | |
} | |
console.log('sum', sum(10, 20)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sum(x, y, callback) { | |
var sum = x + y; | |
if (callback) { | |
callback(sum); | |
} | |
} | |
function logger1(s) { | |
console.log('logger 1: ', s); | |
} | |
function logger2(s) { | |
console.log('logger 2: ', s); | |
} | |
sum(10, 20, logger2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addsFive(x) { | |
return function (y) { | |
return (x + y) + 5; | |
}; | |
} | |
var first = addsFive(10); | |
console.log(first.toString()); | |
var second = first(20, 40); | |
console.log(second); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sum(x, y) { | |
return (x + y); | |
} | |
function multiply(x, y) { | |
var mySum = 0; | |
for (var i = 0; i < x; i++) { | |
mySum = sum(y, y); | |
} | |
console.log(mySum); | |
return (x * y); | |
} | |
console.log('sum', sum(10, 20)); | |
console.log('multiply', multiply(10, 20)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Reading code | |
- Instructions | |
- Inputs | |
- Variables | |
- Outputs | |
2. Scopes | |
- Global scope | |
- Local scope | |
- Chaining scopes | |
3. Functions | |
- The nature of functions | |
- Basics of functions | |
- Nesting functions | |
- Callback functions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment