Last active
August 24, 2018 07:32
-
-
Save mturnwall/039f911bd86295792321e0facd304fb8 to your computer and use it in GitHub Desktop.
Code Exercise 1.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dataOptions = [{ | |
id: '1', | |
name: 'Surgery', | |
value: 'surgery', | |
children: [{ | |
id: '1.1', | |
name: 'Septoplasty', | |
value: 'septoplasty', | |
},{ | |
id: '1.2', | |
name: 'ACL Reconstruction', | |
value: 'acl-reconstruction', | |
},{ | |
id: '1.3', | |
name: 'Craniotomy', | |
value: 'craniotomy', | |
},{ | |
id: '1.4', | |
name: 'Abdominoplasty', | |
value: 'abdominoplasty', | |
}] | |
}, { | |
id: '2', | |
name: 'Chronic condition', | |
value: 'chronic', | |
children: [{ | |
id: '2.1', | |
name: 'Asthma', | |
value: 'asthma', | |
},{ | |
id: '2.2', | |
name: 'Back pain (12+ weeks or longer)', | |
value: 'back-pain', | |
},{ | |
id: '2.3', | |
name: 'Chronic Obstructive Pulmonary Disease (COPD)', | |
value: 'copd', | |
},{ | |
id: '2.4', | |
name: 'Coronary Artery Disease (CAD)', | |
value: 'cad', | |
},{ | |
id: '2.5', | |
name: 'Diabetes', | |
value: 'diabetes', | |
}] | |
}, { | |
id: '3', | |
name: 'Pregnancy', | |
value: 'pregnancy' | |
}, { | |
id: '4', | |
name: 'Post-pregnancy/newborn checkups', | |
value: 'post-pregnancy' | |
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const selected = ['1.1', '1.3', '2.5', '4']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using the array of IDs from input.js, here is what the new array that gets returned should look like. | |
// If the user made no selections, the string 'No major care needs' should be returned. | |
[{ | |
id: '1.1', | |
name: 'Septoplasty', | |
value: 'septoplasty', | |
}, { | |
id: '1.3', | |
name: 'Craniotomy', | |
value: 'craniotomy', | |
}, { | |
id: '2.5', | |
name: 'Diabetes', | |
value: 'diabetes', | |
}, { | |
id: '4', | |
name: 'Post-pregnancy/newborn checkups', | |
value: 'post-pregnancy', | |
}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment