let arr = [ 'nameOneItem' : 'Name one', 'nameTwoItem' : 'Name two' ];
let arr = [
'Name one',
'Name two'
];
let obj = {
'nameOneItem' : 'Name one',
'nameTwoItem' : 'Name two'
};
let out = '';
let arr = Object.values(obj);
for (let i = 0; i < arr.length; i++ ) {
out += '<span>' + arr[i] + '</span>';
}
function isInInterval(start, end) {
return area.value >= start && area.value <= end;
}
const values = floors.value === 1 ? [
[-Infinity, 120, 1.26],
[120.001, 140, 1.24],
[140.001, 160, 1.23],
[160.001, 200, 1.22],
[200.001, 260, 1.2],
[260.001, 300, 1.19]
] : floors.value === 2 || floors.value === 3 ? [
[100, 130, 1.3],
[130.001, 160, 1.27],
[160.001, 200, 1.24],
[200.001, 300, 1.22]
] : [];
const [,, result] = values
.find(([start, end]) => isInInterval(start, end)) || [,, 1];
console.log(result);
const arr = [
"google.com|toster.ru|RU|120|222",
"google.com|toster.ru|RU|120|222",
"google.com|toster.ru|UA|120|222",
"google.com|toster.ru|BG|120|222",
"google.com|yandex.ru|IT|777|843"
];
const result = arr.reduce((acc, curr) => {
const [a, b, geo, c, id] = curr.split('|');
const elem = acc.find(({value}) => value === id);
if (elem) {
if (!elem.items.includes(geo)) {
elem.items.push(geo);
}
} else {
acc.push({
items: [geo],
elems: [a, b, c],
value: id
});
}
return acc;
}, []).map(({items, elems: [a, b, c], value}) => [a, b, items.join('+'), c, value].join('|'));
function isSame(a, b) {
return a.every((item, i) => item === b[i]);
}
arr.reduce((acc, curr) => {
if (acc.every((item) => !isSame(item, curr))) {
acc.push(curr);
}
return acc;
}, []);
fetch('test', {
method: 'POST',
headers: {
"Content-Type": "application/json;odata=verbose",
},
body: JSON.stringify({
"__metadata": { "type": "SP.Data.List4.ListItem" },
})
});
links[links.findIndex((item) => item.id === result.id)] = result;
localStorage.setItem('links', JSON.stringify(links));
{"button": "1"}
, для второй — {"button": "2"}
, при этом текст кнопок может быть одинаковымvar SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
if (SpeechRecognition) {
var recognition = new SpeechRecognition();
// ...
} else {
// не поддерживает
}
Правильно ли я понял, SpeechRecognition это функция-конструктор? И в переменную recognition мы помещаем экземпляр класса SpeechRecognition?да
arr.slice(Math.floor(arr.length / 2)).forEach((_, i) => {
const l = arr.length - i - 1;
[arr[i], arr[l]] = [arr[l], arr[i]];
});