Created
July 17, 2019 15:49
-
-
Save deleteman/c3715cc94c989970db30a15280477243 to your computer and use it in GitHub Desktop.
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
class Person { | |
constructor(name) { | |
this.name = name | |
} | |
} | |
function greet(person) { | |
console.log(this.greeting.replace("$", person.name)) | |
} | |
let english = { | |
greeting: "Hello there, $" | |
} | |
let spanish = { | |
greeting: "Hola $, ¿cómo estás?" | |
} | |
let people = [new Person("Fernando"), new Person("Federico"), new Person("Felipe")] | |
people.forEach( greet, english) | |
people.forEach( greet, spanish) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment