Last active
August 7, 2018 15:36
-
-
Save phwb/6c842a49f1424b0d02ff0584eda55e3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// объявляем константы | |
const MAX_VALUE = 10; | |
// объявляем фукнции | |
function getData () { | |
let result = []; | |
for (let i = 0; i < MAX_VALUE; i += 1) { | |
result = result.concat(i); | |
} | |
return result; | |
} | |
function createItems (data) { | |
const fragment = document.createDocumentFragment(); | |
for (var i = 0, len = data.length; i < len; i += 1) { | |
const item = document.createElement('li'); | |
item.textContent = i; | |
fragment.appendChild(item); | |
} | |
return fragment; | |
} | |
// работа с данными | |
const data = getData(); | |
const items = createItems(data); | |
// работа с DOM | |
const ul = document.createElement('ul'); | |
ul.appendChild(items); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment