Top "Javascript-objects" questions

Use this tag for questions related to JavaScript objects.

__proto__ VS. prototype in JavaScript

This figure again shows that every object has a prototype. Constructor function Foo also has its own __proto__ which is …

javascript prototype javascript-objects prototypal-inheritance
How to copy JavaScript object to new variable NOT by reference?

I wrote a quick jsfiddle here, where I pass a small JSON object to a new variable and modify the …

javascript object javascript-objects
JavaScript error: "is not a function"

It looks like "$smth is not a function" is a very common problem with JavaScript, yet after looking through quite …

javascript javascript-objects
Number of elements in a javascript object

Is there a way to get (from somewhere) the number of elements in a javascript object?? (i.e. constant-time complexity). …

javascript collections elements javascript-objects
Objects inside objects in javascript

I'm somewhat new to Javascript, so maybe this is just a noob mistake, but I haven't found anything that specifically …

javascript object nested javascript-objects
How to sum the values of a JavaScript object?

I'd like to sum the values of an object. I'm used to python where it would just be: sample = { 'a': 1 , …

javascript object javascript-objects
Is this a good way to clone an object in ES6?

Googling for "javascript clone object" brings some really weird results, some of them are hopelessly outdated and some are just …

javascript ecmascript-6 javascript-objects
What’s the difference between “{}” and “[]” while declaring a JavaScript array?

What’s the difference between “{}” and “[]” while declaring a JavaScript array? Normally I declare like var a=[]; What is the …

javascript arrays object javascript-objects declaration
Cannot read property 'style' of undefined -- Uncaught Type Error

I would like to change the color, fontsize and font weight of the text in a span element of the …

javascript html css dom javascript-objects
Comparing two arrays of objects, and exclude the elements who match values into new array in JS

here is my use case in JavaScript: I have two arrays of objects which have properties that match (id & …

javascript arrays underscore.js javascript-objects lodash