document.querySelector('#test').innerHTML += arr.map(n => `
<tr>
<td class="${n.name.firstName}">${n.name.firstName}</td>
<td class="${n.name.lastName}">${n.name.lastName}</td>
<td class="${n.about}">${n.about}</td>
<td class="${n.eyeColor}">${n.eyeColor} ${"<div id = 'eyeColor'; style = 'width: 20px; height: 20px; border-radius: 50%; background-color: red; margin: 0 auto;'>"}</td>
</tr>
`).join('');
var fearNotLetter = str => {
str = str.split('');
if (str.length < 2) return undefined;
let res = [];
for (var i = 0; i < str.length-1; i++){
if (str[i].charCodeAt() > str[i+1].charCodeAt()) {
return ['Error'];
} else
if (str[i].charCodeAt()+1 !== str[i+1].charCodeAt()) {
res.push(String.fromCharCode(str[i].charCodeAt()+1));
str.splice(i+1, 0, String.fromCharCode(str[i].charCodeAt()+1));
i--;
}
}
return res.length > 0 ? res.join(', ') : undefined;
}
var setVal = proc => {
let {x, y} = document.querySelector('.vue-slider-process').getClientRects()[0];
let ev = document.createEvent("MouseEvent");
ev.initMouseEvent(
"click",
true, true,
window, null,
0, 0, x+(parseFloat((parseFloat(getComputedStyle(document.querySelector('.vue-slider-rail')).width.slice(0,-2))/100*proc).toFixed(1))), y,
false, false, false, false,
0, null
);
document.querySelector('.vue-slider-process').dispatchEvent(ev);
}
$('.start').click(function(){
var obj = {};
obj = getData(obj);
console.log(obj);
})
function getData(obj){
var items = [1,2,3];
var result = 4;
obj = {
items,
result
};
return obj;
}
var arr2 = ['h2', 'h3', 'h3', 'h2', 'h2', 'h2', 'h3', 'h4'];
function setList(arr) {
if (arr.length === 0) return '<ul>\n</ul>';
let fullList = '<ul>\n';
let ends = [];
arr.forEach((w,e) => {
if((arr[e+1]) && (parseInt(w[1]) < parseInt(arr[e+1][1]))){
fullList += `<li>${w}\n<ul>\n`;
ends.push('</ul>\n</li>');
} else if ((arr[e+1]) && (parseInt(w[1]) === parseInt(arr[e+1][1]))) {
fullList += `<li>${w}</li>\n`;
} else {
fullList +=`<li>${w}</li>\n` + ends.join('\n') + '\n';
ends = [];
}
})
fullList = fullList + '</ul>';
return fullList;
}
var f = num => num.map(w => (w % 2 == 0 ? w*2 : w));
f([1,2,3,4,5]) // [1, 4, 3, 8, 5]
var f =_=> {
var num = prompt('Введите числа через запятую');
return num.split(',').map(Number).map(w => (w % 2 == 0 ? w*2 : w))
};
setInterval(_=>{
icons.forEach(function(element, i){
setTimeout(function(){
element.style.color = 'white'
setTimeout(_=>{
element.style.color = 'green'
}, 400)
}, 240 * ++i)
});
}, icons.length*200 + 800)