From 82a21b0f8a3d348fce03614bcac68b80837eb296 Mon Sep 17 00:00:00 2001 From: bere abreo Date: Fri, 16 Apr 2021 01:44:01 +0000 Subject: [PATCH] Done. --- index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/index.js b/index.js index e69de29bb..d017757ce 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,21 @@ +var recipes = {}; + +function updateObjectWithKeyAndValue(recipes, key, value) { + return Object.assign({}, recipes, { [key]: value}) +} + +function destructivelyUpdateObjectWithKeyAndValue(recipes, key, value) { + recipes[key] = value; + return recipes; +} + +function deleteFromObjectByKey(recipes, key) { + var newRecipes = Object.assign({}, recipes); + delete newRecipes[key]; + return newRecipes; +} + +function destructivelyDeleteFromObjectByKey(recipes, key) { + delete recipes[key]; + return recipes; +}