Last active
November 9, 2020 09:41
-
-
Save Armand72/b73e835952d2a123ff8e3f157316e416 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
interface User { | |
name:string, | |
age?: number, | |
birthday?: string, | |
} | |
const prettyPrintWilder = (users:User[]):void => { | |
console.log("########################"); | |
users.map((el:User) => { | |
console.log(`${el.name} is ${el.age} years old`); | |
}); | |
console.log("########################"); | |
}; | |
const wilders:User[] = []; | |
const user1:User = { name: "Pierre", age: 23 }; | |
const user2:User = { name: "Paul", birthday: "10/02/1990" }; | |
const user3:User = { name: "Jacques", age: 25 }; | |
wilders.push(user1); | |
wilders.push(user2); | |
wilders.push(user3); | |
const result = prettyPrintWilder(wilders); | |
// le type de retour est void |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment