Как достать три раза по индексу значения из массива?
const info = {
title: 'Hello!!!',
graduatesCount: 2000,
areYouChampion: true,
technologies: ['Front', 'Back', 'Devops']
}
let techSelect = document.createElement('select');
let render = document.createElement('option');
render.append(info.technologies);
techSelect.append(render);
document.body.append(techSelect);
let techSelect = document.createElement('select');
let render = document.createElement('option');
render.append(info.technologies);
techSelect.append(render);
document.body.append(techSelect);
Ответы (1 шт):
Автор решения: ksa
→ Ссылка
Как достать три раза по индексу значения из массива?
Например вот так...
const info = {
title: 'Hello!!!',
graduatesCount: 2000,
areYouChampion: true,
technologies: ['Front', 'Back', 'Devops']
}
const techSelect = document.createElement('select');
for (let i = 0; i < info.technologies.length; i++) {
const render = document.createElement('option');
render.textContent = info.technologies[i];
techSelect.insertAdjacentElement('beforeend', render);
}
document.body.insertAdjacentElement('beforeend', techSelect);