Skip to content

Instantly share code, notes, and snippets.

@sele-nap
Last active March 14, 2022 15:46
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 sele-nap/434f04f31f6127233e6798cf49b95fb4 to your computer and use it in GitHub Desktop.
Save sele-nap/434f04f31f6127233e6798cf49b95fb4 to your computer and use it in GitHub Desktop.
WCS quest // Installation et types basiques
interface User {
name: string;
age: number;
birthday?: string;
}
const prettyPrintWilder = (users: User[]): void => {
users.map((user) => {
console.log(`${user.name} is ${user.age} years old`);
});
};
const wilders: User[] = [];
const user1: User = { name: "Pierre", age: 23 };
const user2: User = { name: "Paul", age: (new Date().getFullYear() - new Date("10/02/1990").getFullYear() )};
const user3: User = { name: "Jacques", age: 25 };
wilders.push(user1);
wilders.push(user2);
wilders.push(user3);
prettyPrintWilder(wilders);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment