const string = "a,b",a b,,,,,,,,,,,,,,,,,,,
const cells = string.split(/,(?!\s*")/);
console.log(cells);
////
[
"a,b",
"a b",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
]
function updateBookCounterAndStatus(selectedBookId, booksArray) {
for (let i = 0; i < booksArray.length; i++) {
if (booksArray[i].book_id === selectedBookId) {
if (booksArray[i].counter > 0) {
booksArray[i].counter--;
if (booksArray[i].counter === 0) {
booksArray[i].isBookAccepted = true;
}
break; // прекратили перебор
}
}
}
}
// Вызываем:
updateBookCounterAndStatus(selectedBook, books);
console.log(books);
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$deal_tel = isset($_REQUEST['tel']) ? $_REQUEST['tel'] : '';
$deal_name = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
$deal_vopros = isset($_REQUEST['vopros']) ? $_REQUEST['vopros'] : '';
}
<template>
<div>
<!-- Компонент Catalog -->
<router-link :to="{ name: 'Bread', params: { selected: selected } }">Go to Bread</router-link>
</div>
</template>
<script>
export default {
data() {
return {
selected: 'some_value', // значение selected
};
},
};
</script>
<template>
<div>
<!-- Компонент Bread -->
<p>{{ selected }}</p>
</div>
</template>
<script>
export default {
props: ['selected'],
mounted() {
console.log(this.selected); // значение доступно в этом компоненте через props
},
};
</script>
const routes = [
{
path: "/",
name: "Main",
component: Main,
children: [
{
path: "",
component: Section,
},
{
path: "/Catalog",
name: "Catalog",
component: Catalog,
children: [
{
path: "/Catalog/Bread",
name: "Bread",
component: Bread,
props: true, // это позволит передать параметры маршрута как props в Bread
},
],
},
],
},
];
let num = Number(prompt('Пожалуйста, введите любое число'));
if (isNaN(num)) {
alert('Введите число');
} else {
if (num % 2 === 0) {
alert('Число четное');
} else {
alert('Число нечетное');
}
}
(function() {
// код
function secretFunction() {
console.log("Секрет!");
}
// код продолжается
})();
const htmlStr = xlsx.write(wb, { type: "binary", bookType: "html", cellStyles: true, });
const htmlStr = xlsx.write(wb, { type: "binary", bookType: "html", bookSST: true, cellStyles: { dateNF: 'YYYY-MM-DD HH:mm:ss', }, type: "base64", });
const wb = xlsx.read(data, { type: "array", });
const wb = xlsx.read(data, { type: "array", cellStyles: true, });
$args = array(
'role' => 'administrator', // Выбрать администраторов
'meta_query' => array(
'relation' => 'OR', // Логическое ИЛИ для следующих условий
array(
'key' => 'your_meta_key', // Замените на ключ мета-поля
'value' => 'your_desired_value', // Значение мета-поля
'compare' => '=', // Сравнение: равно
),
),
);
$user_query = new WP_Query( $args );
// Для одиночного элемента:
let div = document.getElementById('div');
function addClass(el, event, className){
el.addEventListener(event, function(){
el.classList.add(className);
});
};
addClass(div, 'click', 'test'); //функцию вызываем в любом нужном месте. Передаем название переменной, событие и класс
// Для массива элементов:
let elClass = Array.from(document.querySelectorAll('.elClass'));
console.log(elClass);
function adClassArr(targetArr, event, className) {
targetArr.forEach(target => target.addEventListener(event, function(){
target.classList.add(className);
}));
}
adClassArr(elClass, 'click', 'test'); //функцию вызываем в любом нужном месте. Передаем название переменной, событие и класс
<div class="section__titles">
<h2 class="section__title section__title_img">
Последние новости
<span class="section__title-link"><a href="#">Перейти в блог</a></span>
</h2>
</div>
.section__titles {
width: 200px; //нужно подстроить под свой макет
}