worker.slow()оборачивается в новую функцию-декоратор. Декоратор выполняет некую работу, вызывает оригинальную функцию, с ее результатом может выполнить еще какую-то работу, и возвращает итоговый результат.worker.slow = cachingDecorator(worker.slow, hash);worker.slow у вас уже не оригинал, а декоратор. Т.е. эта функцияfunction() {
let key = hash(arguments); // (*)
if (cache.has(key)) {
return cache.get(key);
}
let result = func.call(this, ...arguments); // (**)
cache.set(key, result);
return result;
};arguments.function cachingDecorator(func, hash) {
let cache = new Map();
return function(arg1, arg2) { // явно указать аргументы
let key = hash(arg1, arg2); // (*)
if (cache.has(key)) {
return cache.get(key);
}
let result = func.call(this, arg1, arg2); // (**)
cache.set(key, result);
return result;
};
} Напиши конкретно что сделать нужно, я новичок в этом, ну или пример какой может
{
html: 'Your html markup',
last: false, // or true
}$.ajax({
url:'index.php?route=module/loadMore',
type:"GET",
dataType: 'json',
data: {
module_id: '<?php echo $module_id; ?>',
page : 'id_<?php echo $module_id; ?>',
}
success:function (response) {
$('#app_<?php echo $module_id; ?>').append($(response.html).find('.gdfgdf'));
if (response.last) {
$('#more_button').hide();
}
}
}); input[type=chekbox]:focus + span {
// визуализация фокусного состояния для видимого индикатора
}
input[type=chekbox]:checked + span {
// визуализация отмеченного состояния для видимого индикатора
} let accordionTriggers = document.querySelectorAll('.accordion-item__trigger');
accordionTriggers.forEach(trigger => item.addEventListener('click', () => {
const item = trigger.parentNode;
item.classList.toggle('accordion-item_active');
if(let icon = trigger.querySelector('.accordion-item__title-arrow-off')) {
icon.classList.remove('accordion-item__title-arrow-off')
}
}); next() {
this.currentIndex++;
if (this.currentIndex >= this.slides.length) {
this.currentIndex = 0; // После последнего переходим на первый
}
// … дальше манипуляции со слайдами
}
previous() {
this.currentIndex--;
if (this.currentIndex < 0) {
// После первого переходим на последний (в обратном направлении)
this.currentIndex = this.slides.length - 1;
}
// … дальше манипуляции со слайдами
} .filter должен возвращать булево значение. TRUE - оставить элемент, FALSE - удалитьfunction Validation(arr) {
return arr.filter((el) => {
return typeof el.age === "number"
&& el.full_name !== undefined
&& el.full_name.charAt(0) === el.full_name.charAt(0).toUpperCase()
&& el.gender !== undefined
&& el.gender.charAt(0) === el.gender.charAt(0).toUpperCase()
&& el.note !== undefined
&& el.note.charAt(0) === el.note.charAt(0).toUpperCase()
&& el.state !== undefined
&& el.state.charAt(0) === el.state.charAt(0).toUpperCase()
&& el.city !== undefined
&& el.city.charAt(0) === el.city.charAt(0).toUpperCase()
&& el.country !== undefined
&& el.country.charAt(0) === el.country.charAt(0).toUpperCase()
}function firstLetterIsUpper(str) {
return typeof(str) === 'string'
&& str.length
&& str.charAt(0) === str.charAt(0).toUpperCase()
}
function Validation(arr) {
return arr.filter((el) => {
return typeof el.age === "number"
&& firstLetterIsUpper(el?.full_name)
&& firstLetterIsUpper(el?.gender)
&& firstLetterIsUpper(el?.note)
&& firstLetterIsUpper(el?.state)
&& firstLetterIsUpper(el?.city)
&& firstLetterIsUpper(el?.country)
}