<aside> 💫 丸める:変数名.toFixed()

ある平均値を小数点以下3桁で表示したい ~.toFixed(3);

</aside>

▼例)

{
    const scores = [10, 3, 9];

    let sum = 0;

    //合計
    scores.forEach((score) => {
        sum += score;
    });

    //平均
    const avg = sum / scores.length; //sumをscoresの要素数で割る
    
    **//丸める
    console.log(avg.toFixed(3)); //7.333**

}