JSFiddle - React, Tailwind, and code Playground

by joplomacedo

JavaScript

function createLogger(isDebugMode) {
    return function () {
        var args = Array.prototype.slice.call(arguments)

        if (isDebugMode) {
            console.log.apply(console, args);
        }
    }
}


const willLog =  createLogger(true);
const wontLog =  createLogger(false);

willLog('this will log');
wontLog('this wont log', 'this wint as wel');