Last active
January 27, 2017 23:42
-
-
Save anddoutoi/45ad71d38d81aa401ca61097536eb935 to your computer and use it in GitHub Desktop.
Car Factory
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 makeCar(brand, model) { | |
return { | |
brand, | |
model, | |
}; | |
} | |
const makeToyota = makeCar.bind(null, 'Toyota'); | |
const makeVolvo = makeCar.bind(null, 'Volvo'); | |
const makeToyotaRAV4 = makeCar.bind(null, 'Toyota', 'RAV4'); |
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 toyotaRAV4 = makeToyota('RAV4'); | |
var volvoXC90 = makeVolvo('XC90'); | |
var anotherToyotaRAV4 = makeToyotaRAV4(); | |
console.log(toyotaRAV4); | |
console.log(volvoXC90); | |
console.log(anotherToyotaRAV4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment