-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathscript.js
More file actions
executable file
·32 lines (28 loc) · 1.04 KB
/
script.js
File metadata and controls
executable file
·32 lines (28 loc) · 1.04 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
/**
* Practice: Building objects
*
* - Create JavaScript objects based on objects in your current environment.
* - Give each object an identifiable name.
* - Create properties to describe the objects and set their values.
* - Find an object that has another object inside of it to create a nested object.
* - Test your objects in the browser console by accessing the entire object and its specific properties.
*/
// This is an object:
const gamingPc = {
processor: "Amd",
grapicsCard: "Nvidia",
ram: "32gb",
motherBoard: "asus",
fans: "8",
powerSupplay: "1200w",
};
//Getting the div:
const showPcSpec = document.getElementById("gamingPcDiv");
// Displaying the object in HTML:
showPcSpec.innerHTML = ` <p><strong>Processor:</strong> ${gamingPc.processor}</p>
<p><strong>Grapicscard:</strong> ${gamingPc.grapicsCard}</p>
<p><strong>Ram:</strong> ${gamingPc.ram}</p>
<p><strong>Motherboard:</strong> ${gamingPc.motherBoard}</p>
<p><strong>Fans:</strong> ${gamingPc.fans}</p>
<p><strong>Powersupplay:</strong> ${gamingPc.powerSupplay}</p>
`;