sorting code bricks for JavaScript