-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
65 lines (50 loc) · 1.6 KB
/
index.js
File metadata and controls
65 lines (50 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const root = document.getElementById("root")
root.setAttribute("height", 500)
root.setAttribute("width", 500)
root.setAttribute("class", "container")
root.style.minHeight = "20vh"
// create an element
const h1 = document.createElement("h1")
h1.innerText = "My Application"
h1.setAttribute("id", "appTitle")
h1.style.color = "white"
/// add h1 to the root
root.appendChild(h1)
const p = document.createElement("p")
p.innerText = "Lorem ipksnxc dgiscddbsan xsdcdehdfuyws xwdjhdbvws dhwd wdjwsq"
const black = document.createElement("div")
black.style.backgroundColor ="black"
black.minHeight ='40vh'
black.setAttribute("height", 400)
const bh1 = document.createElement("h1")
bh1.innerText="Sample test of my text"
black.appendChild(bh1)
black.appendChild(p)
black.style.color="white"
const green = document.createElement("div")
green.style.backgroundColor ="green"
green.minHeight ='40vh'
green.setAttribute("height", 400)
green.appendChild(h1)
green.appendChild(p)
const purple = document.createElement("div")
purple.style.backgroundColor ="purple"
purple.minHeight ='20vh'
purple.setAttribute("height", 400)
purple.appendChild(h1)
purple.appendChild(p)
root.appendChild(black)
root.appendChild(green)
root.appendChild(purple)
People.map((person)=> {
const persn = document.createElement("div");
persn.style.borderRadius="50%";
persn.style.padding ="3px";
persn.style.border="1px solid gray"
persn.innerText =person.name
persn.style.height ="300px"
persn.style.width ="300px"
root.appendChild(persn)
})
// arrays - map ,pop,shift
// Practice creating the following tags using javascript: h1, p, a, article, section, ul,li, div