/*
Write a function that takes an array of tuples. 
Each tuple consists of a name (a string) and an age (a number). 
Your function should return only the names.
You'll need to use a loop. It can be a regular for loop, 
a call to .forEach, or a call to .map.
*/

function names(namesAndAges: [string, number][]): string[] {
  return namesAndAges.map(tuple => tuple[0]);
}

// driver code
const namesAndAges: [string, number][] = [
    ['jake', 30],
    ['bake', 20],
    ['bake', 25],
]
console.log(names(namesAndAges))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: