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
Rest Params
lodash
fast function to reverse unsigned integer
To compare; creating async methods in javascript
Holyboi
Count digits
problem_name
Union of two sorted arrays
myfirstmodule.js
JS - check 2 arrays, add 1 or 2, logical operations