This question already has answers here:
What is the difference between these arrays?
(5 answers)
Closed 9 years ago.
In JavaScript, what is the difference between
var stack = {};
and
var stack = [];
The first one is an empty object and the second is an empty array.
Related
This question already has answers here:
Merge multiple objects inside the same array into one object [duplicate]
(2 answers)
Closed 9 months ago.
How to get from this array
[{"one": "deleted"}, {"two": "added"}]
this result
{"one": "deleted", "two": "added"}
you can use Object.assign for that
const data = [{"one": "deleted"}, {"two": "added"}]
console.log(Object.assign({}, ...data))
This question already has answers here:
How to determine equality for two JavaScript objects?
(82 answers)
How to explain object references in ECMAScript terms?
(1 answer)
Javascript Object Identities
(6 answers)
Closed 1 year ago.
If I do:
const o1 = {};
const o2 = {};
is it guaranteed that o1===o2 is false?
This question already has answers here:
How to determine equality for two JavaScript objects?
(82 answers)
How do I check if an array includes a value in JavaScript?
(60 answers)
Closed 3 years ago.
IndexOf cannot find my object. Here is the JsFiddle
let a = [{}]
console.log(a.indexOf({}))
This question already has answers here:
Passing an array as a function parameter in JavaScript
(12 answers)
Closed 6 years ago.
I have
function f(a,b,c) {}
and
const arr = [1,2,3]
What do I need to call
f(arr)
__________________________________________?
One this you can do is:
f.apply({}, arr);
This question already has answers here:
How can I access and process nested objects, arrays, or JSON?
(31 answers)
Closed 7 years ago.
Say I have an array like:
var someArray = [{"id":1,"mid":"477","mname":"StackOverflow","image":"images/merchants/so.jpg"}, {"id":2,"mid":"478","mname":"Meta","image":"images/merchants/mt.jpg"}]
How do I get say the image string images/merchants/so.jpg for example?
someArray[0].image
or
someArray[0]['image']