/\?(.*)/
&
и потом каждую пару разбить на ключ и значение по знаку =
.const url = new URL('https://mydomen.ru/category/search?area=32&city=31');
console.log('host', url.host);
console.log('search', url.search);
const city = url.searchParams.get('city');
console.log('city', city);
const startButton = document.querySelector('button.start');
startButton.insertAdjacentElement('afterend', newDiv);
'beforebegin': Before the targetElement itself.
'afterbegin': Just inside the targetElement, before its first child.
'beforeend': Just inside the targetElement, after its last child.
'afterend': After the targetElement itself.
const asdContainer = document.getElementById('asd-container');
if (asdContainer) {
const text = asdContainer.textContent;
console.log(text);
}
client.on("message", message => {
let responseText;
const words = ['даня', 'клим', 'паша', 'стёпа'];
const firstWord = message.content
.toLowerCase() // в нижний регистр
.replace(/[^а-яёa-z].*/, ''); // удалим первый не буквенный символ и все, что после него
if (firstWord.length === 0) {
responseText = 'Первое слово нулевой длины';
} else if (words.includes(firstWord)) {
responseText = `слово "${firstWord}" есть в массиве`;
} else {
responseText = `слова "${firstWord}" НЕТ в массиве`;
}
message.channel.send(responseText);
message.delete();
});
const msgStr = 'привет, kopatych3756!';
const words = ['привет', 'пока', 'кагдила', 'гдея'];
const firstWord = msgStr.replace(/[^А-ЯЁа-яёA-Za-z].*/, '');
if (words.includes(firstWord)) {
console.log(`слово ${firstWord} есть в массиве`);
} else {
console.log(`слова ${firstWord} нет в массиве`);
}
function showError(field, error) {
field.prepend(`<pre>Ошибка: ${error}</pre>`);
}
if (onlyDigits(last_name.val()) || last_name.val() == "") {
console.log('ошибка фамилии');
showError(last_name, allErrors.last_name);
return false;
} else {
return true;
}
<input name="last_name" required pattern="[А-ЯЁа-яё]+">
field.setCustomValidity("Минимум одна буква");