12 lines
242 B
JavaScript
12 lines
242 B
JavaScript
|
module.exports = (tagName, attributes) => {
|
||
|
const element = document.createElement(tagName)
|
||
|
|
||
|
if (typeof attributes === 'object') {
|
||
|
for (let i in attributes) {
|
||
|
element.setAttribute(i, attributes[i])
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return element
|
||
|
}
|