-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathAll Star Code Challenge #26.js
33 lines (30 loc) · 1.09 KB
/
All Star Code Challenge #26.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
Description:
This Kata is intended as a small challenge for my students
All Star Code Challenge #26
All of Raj's once loner friends are now happily in a relationship. Even Sheldon!
Raj has hired you to manually change his group status to "In a relationship," so he can show it to his friends!
Create a function called missionImpossible() that takes a Group object as input that changes the "Raj" key, if it exists, to "In a relationship". The, now altered, object should be returned.
var wholeGroup = { Leonard: 'Married',
Penny: 'Married',
Howard: 'Married',
Bernadette: 'Married',
Sheldon: 'In a relationship',
Amy: 'In a relationship',
Raj: 'Single' }
missionImpossible(wholeGroup);
// =>
// { Leonard: 'Married',
// Penny: 'Married',
// Howard: 'Married',
// Bernadette: 'Married',
// Sheldon: 'In a relationship',
// Amy: 'In a relationship',
// Raj: 'In a relationship' }
Note: If Raj is not part of the input group, he should NOT be added to it.
*/
function missionImpossible(obj){
if (obj.hasOwnProperty('Raj')){
return Object.assign(obj,{Raj:'In a relationship'})}
return obj
}