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
// ES6 | |
// example 1 | |
([param] [, param]) => { | |
statements | |
} | |
// example 2 | |
param => expression |
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
// ES5 | |
// example 1 | |
function ([param] [, param]) { | |
statements | |
} | |
// example 2 | |
function (param) { | |
return expression |
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 People() { | |
var self = this; // Some choose `that` instead of `self`. | |
self.size = 0; | |
setInterval(function addMorePeople() { | |
// The callback refers to the `self` variable of which | |
// the value is the expected object. | |
self.size++; | |
}, 1000); | |
} |
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 People() { | |
this.size = 0; | |
setInterval(() => { | |
this.size++; | |
}, 1000); | |
} |
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
(param1, param2) => expression | |
// equivalent to: { return expression; } |
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
var someArray = [1, 2, 3, 4] | |
someArray.map( num => num + 1); |
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() { }.bind(this) |
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
access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> | |
secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> |
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
filename = "resume.pdf" | |
uri = URI.parse(“https://someresume.com/resume.pdf”) | |
candidate.resume.attach(io: uri.open, filename: filename) |
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
// String literal example | |
type Easing = "ease-in" | "ease-out"; |
OlderNewer