function checkTime() {
const now = Date.now()
const time = localStorage.getItem('timestamp') || null
if (time) {
if (Number(now) - Number(time) >= 1000 * 60 * 60 * 24) {
console.log('Function called')
localStorage.setItem('timestamp', now)
}
} else {
localStorage.setItem('timestamp', now)
}
}
setInterval(checkTime, 1000 * 60)