Я новичок в python
if change_index <= len(alphabet): result_text += alphabet[change_index]
function Ranges(props) {
const onChange = ({ target: t }) => {
const index = +t.dataset.index;
const value = +t.value;
const values = props.values.map((n, i) => i === index ? value : n);
if (props.max >= values.reduce((acc, n) => acc + n, 0)) {
props.onChange(values);
}
};
return (
<div>
{props.values.map((n, i) => (
<div>
<input
type="range"
data-index={i}
max={props.max}
value={n}
onChange={onChange}
/>
{n}
</div>
))}
</div>
);
}
const groupedAndSortedArr = Object
.values(arr.reduce((acc, n) => ((acc[n[0]] ??= []).push(n), acc), {}))
.sort((a, b) => a[0][0].localeCompare(b[0][0]));
str.split('=').pop()
// или
str.slice(str.indexOf('=') + 1)
str.replace(/[^=]*=/, '')
// или
str.match(/(?<==).*/)[0]
// или
/[^=]*$/.exec(str).shift()
new URLSearchParams(str).get('sort')
Array
.from(new URLSearchParams(str))
.reduce((acc, [ k, v ]) => (
k.endsWith('[]')
? (acc[k.slice(0, -2)] ??= []).push(v)
: acc[k] = v,
acc
), {})
Как правило, все плагины работают от обратного - у них есть возможность передать массив только с неактивными датами.
config.enable
.дата => массив.includes(дата.toLocaleDateString())
:disbaledDates.customPredictor
.beforeShowDay
. $grouped = [];
foreach ($arr as $n) {
$grouped[$n['category_id']][] = $n['text'];
}
foreach ($grouped as $key => $values) {
echo "
<fieldset>
<legend>$key</legend>".
implode('', array_map(fn($n) => "<div>$n</div>", $values))."
</fieldset>";
}
{9}
пусть будет {4,9}
, например. Или {6,9}
. Или... Сами решайте, сколько их должно быть, вам виднее.a-z
, а a-f
. const baseURL = 'https://iss.moex.com//iss/history/engines/stock/markets/index/securities/RGBITR.json';
const params = new URLSearchParams([
[ 'sort_order', 'desc' ],
[ 'iss.meta', 'off' ],
[ 'iss.only', 'history' ],
[ 'history.columns', 'TRADEDATE,CLOSE' ],
]);
fetch(`${baseURL}?${params}`)
.then(r => r.json())
.then(r => {
new Chart(document.querySelector('#chart'), {
type: 'line',
data: {
labels: r.history.data.map(n => n[0]),
datasets: [ {
label: 'hello, world!!',
data: r.history.data.map(n => n[1]),
} ],
},
});
});
fetch(`${baseURL}?${params}`)
.then(r => r.json())
.then(({ history: { data } }) => {
chart.data.labels = data.map(n => n[0]);
chart.data.datasets[0].data = data.map(n => n[1]);
chart.update();
});
const chart = new Chart(document.querySelector('#chart'), {
type: 'line',
data: {
labels: [],
datasets: [ {
label: 'hello, world!!',
data: [],
} ],
},
});
<slot name="placeholder"></slot>
<template #placeholder>
<option value="" disabled>давай, выбирай</option>
</template>