Last active
April 9, 2021 15:52
-
-
Save kevinyc-dri/ea4689e7232cf3b20545cdfa9f6080fa to your computer and use it in GitHub Desktop.
Day 5 of import export
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We learned | |
const allCoffees = require('./data/allCoffees.json') | |
// console.log('this is my list of coffees', coffees) | |
exports.getCoffees = (name) => { | |
allCoffees.forEach((recipe) => { | |
if ( | |
recipe.ingredients.includes('Milk') || | |
recipe.ingredients.includes('Cream') || | |
recipe.ingredients.includes('Steamed Milk') || | |
recipe.ingredients.includes('1oz Steamed Milk') | |
) { | |
console.log(name, 'cant touch this', recipe.id, recipe.title) | |
} | |
}) | |
} | |
// name this function get coffees and export it | |
exports.getCoffeesTitles = function() { | |
// filter all coffees which is an array of objects | |
const coffeeTitles = allCoffees.filter(function(item){ | |
// return each coffee with its title | |
return item.title | |
}) | |
// showing new array with just titles | |
console.log('here is my new array with just titles', coffeeTitles) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment