JSFiddle - React, Tailwind, and code Playground
by Andrey
JavaScript
let count = 0;
function getLength(str) {
return str.length;
}
function decorate(func) {
// TODO: Write your implementation here
return function(str){
count++;
return func(str);
}
}
const decoratedGetLength = decorate(getLength);
console.log(decoratedGetLength(''));
console.log(decoratedGetLength('ab'));
console.log(decoratedGetLength('abcde'));
console.log(count);