function groupValues(arr, defaultValue = null) {
const keys = [...new Set(arr.flatMap(Object.keys))];
return arr.reduce((acc, n) => {
keys.forEach(k => acc[k].push(Object.hasOwn(n, k) ? n[k] : defaultValue));
return acc;
}, Object.fromEntries(keys.map(k => [ k, [] ])));
}
const result = groupValues(arr);
const groupValues = (arr, defaultValue = null) =>
arr.reduce((acc, n, i, a) => (
Object
.keys(n)
.forEach(k => (acc[k] ??= Array(a.length).fill(defaultValue))[i] = n[k]),
acc
), {});
time--
идут лесом.const now = new Date()
на каждом тике таймера.window.onload = () => {
const popUp = document.getElementById('cookiePopup');
function showPopup() {
popUp.classList.add('show');
popUp.classList.remove('hide');
}
function hidePopup() {
popUp.classList.add('hide');
popUp.classList.remove('show');
}
document.getElementById('acceptCookie').addEventListener('click', () => {
localStorage.setItem('cookieAccepted', '1');
hidePopup();
});
if (localStorage.getItem('cookieAccepted') === '1') {
hidePopup();
} else {
showPopup();
}
};
const nodemailer = require('nodemailer');
const directTransport = require('nodemailer-direct-transport');
const fromHost = `mysite.com`;
const from = 'site' + '@' + "gmail.com";
console.log('Email will be sent from:');
console.log(from, '\n');
// Ask for email address
const to = prompt('Enter your email address ').trim();
// Генерируем код
const trueVerificationCode = Math.round(Math.random() * (10e5 - 1)).toString();
const transport = nodemailer.createTransport(directTransport({
name: fromHost
}));
let y = trueVerificationCode;
// Отправляем письмо
transport.sendMail({
from, to,
subject: 'Verify your email address',
html: `
<div style="width:100%;display:flex;flex-direction:column;justify-content:center;
align-items:center;background:lightblue;padding:50px;box-sizing:border-box;">
<h1>Verify your email address</h1>
<p>Site has tried to verify your email address "${to}".
If this wasn't you, ignore and delete this email. Otherwise, the verification code is bellow:</p>
<div style="padding:50px;background:lightgray;border-radius:10px;font-size:30px;
font-family:monospace;">${trueVerificationCode}</div></div>
`
}, (err, data) => {
if (err) {
console.error('There was an error:', err);
} else {
console.log('\nVerification email sent, check your inbox\n');
const userVerificationCode = prompt('Enter your verification code ');
if (userVerificationCode == trueVerificationCode) {
console.log('Email address verified');
} else {
console.log('Code incorrect');
}
}
});
You can also refer to a React component using dot-notation from within JSX. This is convenient if you have a single module that exports many React components. For example, if MyComponents.DatePicker is a component, you can use it directly from JSX with:
import React from 'react'; const MyComponents = { DatePicker: function DatePicker(props) { return <div>Imagine a {props.color} datepicker here.</div>; } } function BlueDatePicker() { return <MyComponents.DatePicker color="blue" />; }
Интересует мнениеСобирать мнения и проводить опросы тут нельзя. Правила. Лучше задавать вопрос, на который можно дать однозначный проверяемый воспроизводимый ответ.