Example: Adding objects
Notice that elements are created in order from the object closest to the root of the tree downwards and attached in the opposite order: here the ordered list elementAn HTML element for an ordered list, tag name <code>ol</code>. is created before any of the list item elementsAn HTML element for an item in a list, tag name <code>li</code>. and they are attached in the opposite order.
Note:
Hints:
- undefined
1
2
var bodyNode = document.body;
var listNode = document.createElement("ol");
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX