This example project is written in Node, and tested with Jest.
npm install
npm test
John’s clothing store has a pile of loose socks where each sock i has a value denoting its color socks[i]. He wants to sell as many socks as possible, but his customers will only buy them in matching pairs. Two socks are a single matching pairs if their value are equal: socks[i] === socks[j] . Given an array socks which will hold all the socks value, how many pairs of socks can John sell?.
We’re given an array socks where each item in the array socks[i] contains a value representing the sock color.
An array of color values representing each sock’s color: socks = [10, 20, 20, 10, 10, 30, 50, 10, 20];
The tests are failing right now because we're not returning the correct string. Fixing this up will make the tests green.