JavaScript tofixed sin ceros finales

Number(n.toFixed(4));
Prickly Porcupine