Skip to content

Instantly share code, notes, and snippets.

@clrko
Last active November 9, 2020 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clrko/04f6f39e515d2b8631fa4fb04d6e2a41 to your computer and use it in GitHub Desktop.
Save clrko/04f6f39e515d2b8631fa4fb04d6e2a41 to your computer and use it in GitHub Desktop.
challenge Dcouverte TypeScripte
const prettyPrintWilder = (users: { name: string; age?: number ; birthday?: string}[]) => {
console.log("########################");
users.map((el) => {
console.log(`${el.name} is ${el.age} years old`);
});
console.log("########################");
};
// # autre synthaxe
// interface User {
// name: string,
// age?: number,
// birthday?: string
// }
//
// const prettyPrintWilder = (users: User[]) => {
// ...
// };
const wilders = [];
const user1 = { name: "Pierre", age: 23 };
const user2 = { name: "Paul", birthday: "10/02/1990" };
const user3 = { name: "Jacques", age: 25 };
wilders.push(user1);
wilders.push(user2);
wilders.push(user3);
prettyPrintWilder(wilders); // void
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment