News for hackers. Stuff that matters.
Re:Show HN: Virtual pet game made for my daughter by nkrisc on Thursday November 21, 2019 @12:18PM (#21596557)
Destructuring, that rings a bell. Thank you.
Re:Show HN: Virtual pet game made for my daughter by capableweb on Thursday November 21, 2019 @01:25PM (#21597494)
Yeah, the trick is basically many things chained together. First is to pass a object to a function instead of position-locked arguments. Second is to default to a empty object. Third is to destruct the object in the function parameter directly. Fourth to supply default destruct values. Fifth is to set the values in the current instance of that class.