let a = 2
let b = 2
switch(a === b) {
case true:
console.log('1');
break
}
const week = ['Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота', 'Воскресенье'];
week.forEach((day, index) => {
const element = document.createElement('p');
if (index < 5) {
element.textContent = day;
} else {
const wrapper = document.createElement('strong');
wrapper.textContent = day;
element.append(wrapper);
}
document.body.append(element);
});
document.write(week.slice(0,-2).join(',') + ',' + week.slice(-2).join(',').bold());
const week = ['Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота', 'Воскресенье'];
for (let i = 0; i < week.length; i++) {
if (week[i] === 'Суббота' || week[i] === 'Воскресенье') {
document.write(week[i].bold());
} else {
document.write(week[i]);
}
}
const week = [{title: 'Понедельник', weekend: false}, ... {title: 'Воскресенье', weekend: true}];
for (let i = 0; i < week.length; i++) {
document.write(week[i].weekend ? week[i].title.bold() : week[i].title);
}
Angular.js - React.js - Vue.js
Python -> Django
JavaScript - Node.js - Express -> SQL - MySQL - PostgreSQL -> MongoDB
{
"title": "sun",
"subtitle": "earth",
"r": "mars"
}
<h1 id="title"></h1>
<h2 id="subtitle"></h2
<p id="r"></p>
let data = loadJSON('jsons\indexes.json');
document.getElementById('title').innerHTML = data.title;
document.getElementById('subtitle').innerHTML = data.subtitle;
document.getElementById('r').innerHTML = data.r;