The Friendship Algorithm as outlined by The Big Bang Theory captured in JavaScript.