This file contains hidden or 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
var link = function(height = 50, color = 'red', url = 'http://azat.co') { | |
... | |
} |
This file contains hidden or 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
var link = function (height, color, url) { | |
var height = height || 50 | |
var color = color || 'red' | |
var url = url || 'http://azat.co' | |
... | |
} |
This file contains hidden or 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 createCounter() { | |
let counter = 0 | |
const myFunction = function() { | |
counter = counter + 1 | |
return counter | |
} | |
return myFunction | |
} | |
const increment = createCounter() | |
const c1 = increment() |
This file contains hidden or 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
let val = 7 | |
function createAdder() { | |
function addNumbers(a, b) { | |
let ret = a + b | |
return ret | |
} | |
return addNumbers | |
} | |
let adder = createAdder() | |
let sum = adder(val, 8) |
This file contains hidden or 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
let val1 = 2 | |
function multiplyThis(n) { | |
let ret = n * val1 | |
return ret | |
} | |
let multiplied = multiplyThis(6) | |
console.log('example of scope:', multiplied) |
This file contains hidden or 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
{ | |
"this": 1, | |
"is": 1, | |
"a": 2, | |
"class": 1, | |
"of": 1, | |
"advance": 1, | |
"javascript": 2, | |
"from": 1, | |
... |
This file contains hidden or 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
array.find(function(currentValue, index, arr),thisValue) |
This file contains hidden or 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
{ | |
const hello = 'Hello ICFers!' | |
console.log(hello) // 'Hello ICFers!' | |
} | |
console.log(hello) // Error, hello is not defined |
This file contains hidden or 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 sayHello () { | |
const hello = 'Hello ICFers!' | |
console.log(hello) | |
} | |
sayHello() // 'Hello ICFers!' | |
console.log(hello) // Error, hello is not defined |
This file contains hidden or 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 sayHello () { | |
const hello = 'Hello CSS-Tricks Reader!' | |
console.log(hello) | |
} | |
sayHello() // 'Hello CSS-Tricks Reader!' | |
console.log(hello) // Error, hello is not defined |