About 50 results
Open links in new tab
  1. Which way is best for creating an object in JavaScript? Is `var ...

    Jul 27, 2011 · Using a constructer function to create an object or object literal notation is using alot in JavaScript. Also creating an instance of Object and then adding properties and methods to it, there …

  2. javascript - Using "Object.create" instead of "new" - Stack Overflow

    Apr 26, 2010 · Javascript 1.9.3 / ECMAScript 5 introduces Object.create, which Douglas Crockford amongst others has been advocating for a long time. How do I replace new in the code below with …

  3. How to "properly" create a custom object in JavaScript?

    Oct 20, 2009 · In Javascript a function is an object, and can be used to construct objects out of together with the new operator. By convention, functions intended to be used as constructors start with a …

  4. Javascript creating objects - multiple approaches, any differences ...

    Functions are very special in Javascript. They are objects, they can create other objects and they automatically get a field called prototype. A prototype is a plain object with a single field, called …

  5. Creating New Objects in JavaScript - Stack Overflow

    Sep 18, 2011 · 7 I'm a relatively newbie to object oriented programming in JavaScript, and I'm unsure of the "best" way to define and use objects in JavaScript. I've seen the "canonical" way to define …

  6. What is the most efficient way to deep clone an object in JavaScript ...

    Sep 23, 2008 · Lastly if you are attempting to clone a known object structure in a hot loop you can get MUCH MUCH MORE PERFORMANCE by simply in-lining the clone procedure and manually …

  7. How do I correctly clone a JavaScript object? - Stack Overflow

    Apr 8, 2009 · Also, an object's prototype is referenced with the attribute __proto__, which is also hidden, and will not be copied by a for/in loop iterating over the source object's attributes. I think __proto__ …

  8. Is it possible to add dynamically named properties to JavaScript object ...

    In JavaScript, I've created an object like so: var data = { 'PropertyA': 1, 'PropertyB': 2, 'PropertyC': 3 }; Is it possible to add further properties to this object after its initial

  9. javascript - Create object from array - Stack Overflow

    The new Object.fromEntries, from ECMAScript 2019, makes it even easier to transform values from an array into keys in an object like follows

  10. How to create a dictionary and add key value pairs dynamically in ...

    This does not create a "normal" JavaScript object literal (aka map, aka hash, aka dictionary). It is however creating the structure that OP asked for (and which is illustrated in the other question linked …