const logOut = () => {
const user = JSON.parse(localStorage.getItem("User"));
if(JSON.parse(localStorage.getItem("Users")=== null)) {
const users = [];
users.push(user);
localStorage.setItem('Users', JSON.stringify(users));
} else {
const users = JSON.parse(localStorage.getItem("Users"));
users.push(user);
localStorage.setItem("Users", JSON.stringify(users));
}
window.location = './form.html';
};
const cards = document.querySelectorAll('.memory-card');
let hasFlippedCard = false;
let firstCard, secondCard;
const flipCard = (e) => {
const card = e.currentTarget;
card.classList.add('flip');
if (!hasFlippedCard) {
hasFlippedCard = true;
firstCard = this;
return;
}
secondCard = this;
hasFlippedCard = false;
checkForMatch();
};
const checkForMatch = () => {
if (firstCard.dataset.color === secondCard.dataset.color) {
removeFlipCards();
return;
}
unFlippedCards();
};
const removeFlipCards = () => {
firstCard.style.display = 'none';
secondCard.style.display = 'none';
};
const unFlippedCards = () => {
setTimeout(() => {
firstCard.classList.remove('flip');
secondCard.classList.remove('flip');
}, 1500);
};
cards.forEach(card => card.addEventListener('click', flipCard));
app.get("*", function(req, res) {
res.sendFile(path.join(__dirname, "/build", "index.html"));
});
console.log(sum(1)(2)(3)(4)()); //10
const a = sum(4)(3);
console.log(a); //7
const b = a(1)(2)(5);
console.log(b); //15
const c = b();
console.log(c)//15
(numberTwo) => {
if (typeof numberTwo === "undefined"){
return numberOne;
}
return sum (numberOne + numberTwo);
}
На хостинг (https://support.by/hosting/shared/) в public html закидываю содержимое папки build, всё хорошо работает, кроме иконки.