GithubHelp home page GithubHelp logo

js-hashes-lab-v-000's Introduction

Recipe Maker

Objectives

  • Create an object
  • Add key-value pairs to an object
  • Replace values in an object
  • Delete key-value pairs in an object

Instructions

  • Create a function addIngredient that accepts three arguments: a recipe object, an ingredient name (a key in the object) and the amounts (the value of the ingredient key). The body of the function should add the key-value pair to the recipe object, and then return the updated object.

You'll want to be able to use the function like this:

var tacoIngredients = {tortillas: "1 dozen, small"}
addIngredient(tacoIngredients, "cheese", "a lot")
tacoIngredients //=> {tortillas: "1 dozen, small", cheese: "a lot"}
  • Create a function removeIngredient which accepts two parameters, the recipe you would like to remove an ingredient from, and the ingredient you would like to remove. The function should return the updated recipe.

  • Create a function updateIngredient which accepts three parameters: the recipe, the ingredient you'd like to update, and the amount of that ingredient. The function should update the hash and return the updated hash.

  • Create a function readRecipe which accepts a recipe object as a parameter. The function should console.log a string of each ingredient and the amount "this recipe calls for <amount> of <ingredient>"

View Recipe Maker on Learn.co and start learning to code for free.

View Hashes in JS Lab on Learn.co and start learning to code for free.

js-hashes-lab-v-000's People

Contributors

annjohn avatar runyans7 avatar victhevenot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.