Привет, как вывести дочерние узлы кроме первого и последнего?
document.body.firstElementChild;
Text
Other
Next
Last
Ответ
if (document.body.children) {
const children = document.body.children;
for (var i = 1; i < children.length - 1; ++i) {
console.log(children[i])
}
}
Комментариев нет:
Отправить комментарий