🚴 JavaScript exercise for Sleep Number interviewees
Convert an array of Person
objects into a tree of PersonTreeNode
objects.
- Clone the repository
- Open
index.html
in your browser - Open
js/Person.js
,js/PersonTreeNode.js
, andjs/answer.js
in your favorite editor - Add your code to the
generateTree
function inanswer.js
- The exercise uses two JavaScript classes:
Pesron
andPersonTreeNode
- The
generateTree
function receives an array ofPerson
objects and should return the rootPersonTreeNode
(CEO) - Each
PersonTreeNode
'sdirectReports
array should contain aPersonTreeNode
for each direct report of that person - The app will use your
generateTree
function to evaluate the test - Refresh the page or click the button to re-run the test