pepopowitz’s avatarpepopowitz’s Twitter Archive—№ 3,363

  1. TIL: 1. Spreading an object in JavaScript e.g. {...thing} does not include properties from the object's prototype, and 2. There's a situation where I care that spreading an object doesn't include properties from the prototype. I was more surprised by #2 than #1.
    1. …in reply to @pepopowitz
      The situation where I cared was that I was trying to "clone" a React event, with one property modified. By spreading the event into a new one, I was effectively removing almost all the properties of the event (because most of them were on the prototype).
      1. …in reply to @pepopowitz
        This totally feels like the kind of "trivia" that one would be grilled on in a bust-em style technical interview. Will I ever forget it? No. Will it ever come in useful again in my life? Probably also no. And I guess that's how bust-em technical interview questions are born.