Implementation of fun algorithms on javascript