#Functional way. No variable, no loop, only mapReduce. Output all result. Usage: Clone this repo, open the index.html in chrome or browser. The function is alraedy defined in console. Input example: {1:[2,4], 2:[1,3], 3:[2,4], 4:[1,3]}