Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
// Write your solution in this file!
const employee = {
name: "Nihar",
streetAddress: "300 Pickwick Dr.",
};
function updateEmployeeWithKeyAndValue(employee, key, value){
return {
...employee,
[key]: value
};
}
function destructivelyUpdateEmployeeWithKeyAndValue(employee, key, value){
employee[key] = value
return employee
}
function deleteFromEmployeeByKey(employee, key){
const newEmployee = {...employee}
delete newEmployee[key]
return newEmployee
}
function destructivelyDeleteFromEmployeeByKey(employee, key){
delete employee[key]
return employee
}