15 Matching Annotations
  1. Dec 2023
    1. We can use the call() method to copy over properties from one constructor into another constructor. Let’s create a Warrior and a Healer constructor.
  2. Nov 2021
  3. Jun 2021
  4. Mar 2021
  5. Oct 2020
    1. for (var member in myObject) delete myObject[member]; ...would seem to be pretty effective in cleaning the object in one line of code

      But checking hasOwnProperty is probably better/safer idea:

      for (var prop in obj) { if (obj.hasOwnProperty(prop)) { delete obj[prop]; } }
      
  6. Sep 2020
  7. Sep 2019
    1. Using reduce and Object.keys As (1), in combination with Object.assign Using map and spread syntax instead of reduce Using Object.entries and Object.fromEntries
  8. Jul 2018