Created
November 12, 2024 11:57
-
-
Save kdankov/8a43227c5693db531236f62acd9addde to your computer and use it in GitHub Desktop.
Fun with JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function solve(s, o) { | |
Object | |
.entries([...s, ...o].reduce((s, p, i, a) => ( i % 2 === 0 ? { ...s, [p]: (s[p] || 0) + Number(a[i + 1]) } : s), {})) | |
.forEach(([p, q]) => console.log(`${p} -> ${q}`)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment