From 827eb44d6a7eb9ebb3ca2d7f8339b34ba23cc0b5 Mon Sep 17 00:00:00 2001 From: dandy-collaborator-4866 Date: Wed, 9 Dec 2020 17:48:59 +0000 Subject: [PATCH] Done. --- index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/index.js b/index.js index e69de29bb2..7d17d29496 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,23 @@ +var obj = {} + +function updateObjectWithKeyAndValue(obj, key, value){ + return Object.assign ({}, obj, { [key]: value }); +} + +function destructivelyUpdateObjectWithKeyAndValue (obj, key, value){ + obj.prop2 = 2 + return obj; +} + +function deleteFromObjectByKey(obj, key){ + var obj = { prop: 1 } + var newObj = Object.assign({}, obj) + delete newObj.prop + return newObj + return obj +} + +function destructivelyDeleteFromObjectByKey(obj, key){ + delete obj.prop; + return obj; +}