Fractal curve generation using JavaScript