Some famous algorithm in javascript