Implement Sort Algorithms in js