Look at an implementation of the NEAT algorithm in JavaScript! It's an evolutionary algorithm originally introduced in 2002 by Kenneth O. Stanley and Risto Miikkulainen in their paper Evolving Neural Networks Through Augmenting Topologies.
If you want to learn more about the project, or see this and more simulations in action, you can look at the GitHub repo!
http://github.com/joshuadam/neat-javascript