Friday, August 26, 2022

This two codes have the same return

I simplify 

    const getCode = (function () {
        const apiCode = '0]Eal(eh&2'; // A code we do not want outsiders to be able to modify...
            return apiCode;  
    });

    getCode();
    put(getCode());

This one that I got from MDN

    const getCode = (function () {
        const apiCode = '0]Eal(eh&2'; // A code we do not want outsiders to be able to modify...
        return function () {
            return apiCode;
        };
    })();

    getCode();
    put(getCode());

Rute Bezerra de Menezes Gondim




No comments:

Post a Comment