Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Accept matching keys in object
//nodejs v4.2.6 var arr = [{1: 36011, 2: 18320, 3: 36011, 4: 10570}, {1: 19754, 2: 6722, 3: 19754, 4: 6699}, {1: 15711, 2: 10039, 3: 15711, 4: 4172}] var output = {} for(var obj of arr){ for(var key in obj){ if(key in output){ output[key].push(obj[key]) } else { output [key] = [obj[key]] } } } console.log(output)
run
|
edit
|
history
|
help
0
JSON parse
Counting digits
JS - check 2 arrays, add 1 or 2, logical operations
Holyboi
Sort based on keys
AVL-GO-FLAT
Include object in a query string
Add items on Set
Compare 2 arrays and fill 1 or 2
problem_name