I am trying to use an array to change a different variable but it keeps saying "malformed arrow function parameter list"


I am trying to use an array called game.clicks in a variable "convert"

var convert = game.clicks => {
            if (game.clicks < 1e3) return game.clicks;
            if (game.clicks >= 1e3 && game.clicks < 1e6) return +(game.clicks / 1e3).toFixed(1) + "K";
            if (game.clicks >= 1e6 && game.clicks < 1e9) return +(game.clicks / 1e6).toFixed(1) + "M";
            if (game.clicks >= 1e9 && game.clicks < 1e12) return +(game.clicks / 1e9).toFixed(1) + "B";
            if (game.clicks >= 1e12 && game.clicks < 1e15) return +(game.clicks / 1e12).toFixed(1) + "T";
            if (game.clicks >= 1e15 && game.clicks < 1e18) return +(game.clicks / 1e15).toFixed(1) + "Qa";
            if (game.clicks >= 1e18 && game.clicks < 1e21) return +(game.clicks / 1e18).toFixed(1) + "Qi";
            if (game.clicks >= 1e21 && game.clicks < 1e24) return +(game.clicks / 1e21).toFixed(1) + "Sx";
            if (game.clicks >= 1e24 && game.clicks < 1e27) return +(game.clicks / 1e24).toFixed(1) + "Sp";
            if (game.clicks >= 1e27 && game.clicks < 1e30) return +(game.clicks / 1e27).toFixed(1) + "Oc";
            if (game.clicks >= 1e30 && game.clicks < 1e33) return +(game.clicks / 1e30).toFixed(1) + "No";
            if (game.clicks >= 1e31) return game.clicks.toExponential(2);
        }

but it throws

malformed arrow function parameter list

pls help i have no idea what im doing

Source: JavaSript – Stack Overflow

October 16, 2021
Category : News
Tags: arrays | game-development | html | javascript | notation

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.