JSFiddle - React, Tailwind, and code Playground

by borisjavier

JavaScript

const N = 6;

    function peguele() {
        if (N < 0 || !Number.isInteger(N)) {
            throw new Error("Invalid array size");
        }

        const falseArrayString = `[${'false, '.repeat(N).slice(0, -2)}]`;
        //const array = JSON.parse(falseArrayString);
        return falseArrayString;//array as FixedArray<boolean, typeof N>;
    }
    
console.log(peguele())