1. Given the following dataset, return an array of just the front-end classrooms
let classrooms = [
{ roomLetter: 'A', program: 'FE', capacity: 32 },
{ roomLetter: 'B', program: 'BE', capacity: 29 },
{ roomLetter: 'C', program: 'FE', capacity: 27 },
{ roomLetter: 'D', program: 'BE', capacity: 30 },
{ roomLetter: 'E', program: 'FE', capacity: 22 },
{ roomLetter: 'F', program: 'BE', capacity: 19 },
{ roomLetter: 'G', program: 'FE', capacity: 29 },
{ roomLetter: 'H', program: 'BE', capacity: 18 }
];
Example Output:
[
{ roomLetter: 'A', program: 'FE', capacity: 32 },
{ roomLetter: 'C', program: 'FE', capacity: 27 },
{ roomLetter: 'E', program: 'FE', capacity: 22 },
{ roomLetter: 'G', program: 'FE', capacity: 29 }
]
2. Given the following dataset, return an array of objects where the keys are mod
(value: the number of the module) and studentsPerInstructor
(value: how many students per instructor there are for that mod.)
let mods = [
{ mod: 1, students: 27, instructors: 3 },
{ mod: 2, students: 33, instructors: 3 },
{ mod: 3, students: 20, instructors: 2 },
{ mod: 4, students: 16, instructors: 2 }
];
Example Output:
[
{ mod: 1, studentsPerInstructor: 9 },
{ mod: 2, studentsPerInstructor: 11 },
{ mod: 3, studentsPerInstructor: 10 },
{ mod: 4, studentsPerInstructor: 8 }
]
3. Given the following dataset, return an array of all the instructors who can teach JavaScript.
let instructors = [
{ name: 'Pam', module: 2, teaches: ['scope', 'recursion', 'node'] },
{ name: 'Brittany', module: 2, teaches: ['oop', 'pwas'] },
{ name: 'Nathaniel', module: 2, teaches: ['oop', 'scope', 'mobile'] },
{ name: 'Robbie', module: 4, teaches: ['node', 'pwas'] },
{ name: 'Leta', module: 4, teaches: ['pwas', 'node', 'recursion'] },
{ name: 'Travis', module: 1, teaches: ['javascript', 'html', 'css'] },
{ name: 'Louisa', module: 1, teaches: ['javascript', 'html', 'css', 'node', 'pwas'] },
{ name: 'Christie', module: 3, teaches: ['javascript', 'react', 'node'] },
{ name: 'Will', module: 3, teaches: ['javascript', 'redux', 'react', 'oop', 'scope'] }
];
Example Output:
['Travis', 'Louisa', 'Christie', 'Will']
4. Given the following dataset, return an object where the keys are 'feCapacity' and 'beCapacity', and the values are the total capacity for all classrooms in each program.
let classrooms = [
{ roomLetter: 'A', program: 'FE', capacity: 32 },
{ roomLetter: 'B', program: 'BE', capacity: 29 },
{ roomLetter: 'C', program: 'FE', capacity: 27 },
{ roomLetter: 'D', program: 'BE', capacity: 30 },
{ roomLetter: 'E', program: 'FE', capacity: 22 },
{ roomLetter: 'F', program: 'BE', capacity: 19 },
{ roomLetter: 'G', program: 'FE', capacity: 29 },
{ roomLetter: 'H', program: 'BE', capacity: 18 }
];
Example Output:
{
feCapacity: 110,
beCapacity: 96
}
5. Given the following dataset, return an array of all unique toppings that the bakery needs. (no duplicates)
let bakery = [
{
cakeFlavor: 'dark chocolate',
filling: null,
frosting: 'dark chocolate ganache',
toppings: [ 'dutch process cocoa', 'toasted sugar', 'smoked sea salt' ]
},
{
cakeFlavor: 'yellow',
filling: 'citrus glaze',
frosting: 'chantilly cream',
toppings: [ 'berries', 'edible flowers' ]
},
{
cakeFlavor: 'white chiffon',
filling: 'mint and sage drizzle',
frosting: 'whipped sweet cream',
toppings: [ 'mint', 'cranberry', 'edible flowers' ]
},
{
cakeFlavor: 'butter rum',
filling: 'ginger cardamom swirl',
frosting: 'spiced rum glaze',
toppings: [ 'crystallized ginger', 'toasted sugar' ]
},
{
cakeFlavor: 'vanilla',
filling: 'St Germaine',
frosting: 'whipped cream',
toppings: [ 'smoked sea salt', 'crystallized ginger', 'berries' ]
},
{
cakeFlavor: 'honey',
filling: 'chocolate and cayenne',
frosting: 'chocolate buttercream',
toppings: [ 'smoked sea salt', 'toasted sugar' ]
}
];
Example Output:
['dutch process cocoa', 'toasted sugar', 'smoked sea salt', 'berries', 'edible flowers', 'mint', 'cranberry', 'crystallized ginger']