Imagine I have the following code:
function log(level, message) {
console.log(level + " " + message);
}
function supplyToLogger() {
log(...arguments);
}
supplyToLogger("WARN", "This is a warning.");
How can I supply the arguments
object to the log
function without the spread operator? I need this to work in IE11, without the use of polyfills.
Like this:
function log(level, message) {
console.log(level + " " + message);
}
function supplyToLogger() {
log.apply(null, arguments);
}
supplyToLogger("WARN", "This is a warning.");