Skip to content

Instantly share code, notes, and snippets.

@bapHyv
Created September 19, 2022 13:59
Show Gist options
  • Select an option

  • Save bapHyv/96308abe78fbae68dd5dd20dcc8049ae to your computer and use it in GitHub Desktop.

Select an option

Save bapHyv/96308abe78fbae68dd5dd20dcc8049ae to your computer and use it in GitHub Desktop.
interface User {
name: string,
age: number
}
type ppw = (users: User[]) => void
const prettyPrintWilder: ppw = (users) => {
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: 32 };
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