Skip to main content

Exercise 27

  • Create the following folder/file structure:
/ex_27
|-- index.html

index.html

  • Create a basic HTML document
  • Create a script tag on the document head element
  • Add the following html code
<!DOCTYPE html>
<html lang="en">
<head>
<title>It's all JavaScript Baby!!</title>
</head>
<body></body>
</html>
  • Select the body element
  • Define a numbers array with numbers between 1 and 100
  • Create a ul element
  • Iterate the numbers array and execute the following task for each item:
    • Create a li element
    • Set the following text: Item %number% as li element content
    • Add color: #ddd as li element style property if it's even number
    • Else add color: #eee as li element style property
    • Insert each list item into the ul element
  • Insert the ul element into the body element