Added JavaScript version 

Its not perfect but...