Linked Questions

1 vote
1 answer
208 views

I have had discussions with seasoned programmers who do not think arrays are objects; they think that objects and arrays are of separate types of the data structure category. But, as far as I ...
Custer's user avatar
  • 117
1 vote
1 answer
250 views

I played around with the Object.assign function and found out that i can create an array object fusion kinda? the code looks like this: var list = [1, 2, 3] Object.assign(list, {property: true}) the ...
Atilla's user avatar
  • 41
0 votes
1 answer
81 views

I am aware that everything is an object in JavaScript but something struck me when i was using the console of Internet Explorer -F12 (Yes IE, not allowed to use other browsers) If i type a sample ...
krishna's user avatar
  • 595
-4 votes
2 answers
181 views

I'm looking for an elegant way of understanding JavaScript array and objects. I came to an anomaly in which I got stuck. Since in PHP or other languages, when we make an array e.g $a = [ admin =&...
Saddam's user avatar
  • 1,206
2 votes
1 answer
106 views

A colleague, by mistake wrote this code: var parameters = []; // some lengthy code here parameters.firstParameter = "first parameter value"; parameters.secondParameter = "second parameter value"; He ...
1 vote
0 answers
58 views

A strange behavior of array assignment at index: array[<some string>]. Let's say I have a normal array: const arr = [1, 2, 3]; // undefined If I type: arr['.'] = 4; // 4 arr // (3) [1, 2, 3, .:...
MaxG's user avatar
  • 1,077
0 votes
0 answers
41 views

I was stumbling around in JavaScript and was wondering why my tests were still working, although I changed a constant from an Object to a Variable. I'm aware that Object properties can be accessed by ...
0 votes
0 answers
31 views

Why do javascript arrays allow me to use a string as a key index? For example, let r = []; r['test'] = 'testvalue' // [testvalue: 321] Arrays can be used like objects. Is that because everything in ...
0 votes
0 answers
29 views

Today i'm facing a really strange behavior, check this out ! const person = []; person.name = "Hello World" console.log(person) // [name: "Hello World"] That is crazy, I just pushed some key - value ...
J.doe's user avatar
  • 185
1037 votes
77 answers
987k views

A strict equality operator will tell you if two object types are equal. However, is there a way to tell if two objects are equal, much like the hash code value in Java? Stack Overflow question Is ...
user avatar
11 votes
4 answers
16k views

I recently learned about optional chaining in Javascript and have been making use of it in a React/NodeJS project. Works great. I noticed I have been using it with arrays map, even without thinking ...
3 votes
3 answers
13k views

So I was reading an article to clone an object and array. All of them mentioned that Object.assign() can be used to copy an object but no one mentioned that Object.assign() will also work to shallow ...
2 votes
4 answers
14k views

I definitely need some light on this. What's the diference between: var MY_APP = function(){ this.firstMethod = function(){ //something }; this.secondMethod = function(){ //...
1 vote
5 answers
1k views

I am trying to understand something in JavaScript. Lets say I do the following: let x = []; x['Monday'] = 'Work'; x['Tuesday'] = 'More Work'; console.log(x) //[Monday: "Work", Tuesday:...
2 votes
2 answers
2k views

I want to change only one element of a multidimensional array // nodes is a 2-dimensional array // of 30 rows and 30 columns this.state = {nodes}; // updatedNodes is a deep copy of nodes ...

15 30 50 per page
1
2 3