I am a believer of the Root Cause Analysis. Ask "How, What, Why" until you can dissect it with no further to go. Well, I am a frontend developer ready for new challenges!
I was given an object and asked to create a copy.
I happily said Object.assign...
So these there the follow ups that screwed me over-
What if it has nested objects, then Object.assign wont deep clone it. (where i answered with a loop to resolve this issue)
What if there is a cyclic dependency? (I was stuck, but the interviewer insinuated to the tortoise-hare algo of two pointer solution to crack the cyclic dependency, although i still dont think that will help).
Note- I was to answer in VanillaJS, so answers like Lodash deep clone wouldnt work.
Anyways, I went back and learnt a lot while exploring this concept.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I was given an object and asked to create a copy.
I happily said Object.assign...
So these there the follow ups that screwed me over-
Note- I was to answer in VanillaJS, so answers like Lodash deep clone wouldnt work.
Anyways, I went back and learnt a lot while exploring this concept.