-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab2.js
More file actions
38 lines (30 loc) · 924 Bytes
/
lab2.js
File metadata and controls
38 lines (30 loc) · 924 Bytes
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
// Create an object for a "Teacher" with the following properties
// - Name (with anyone's name)
// - Classes (with an empty array)
// - currentlyTeaching (true or false, your choice)
// Now with the above object do the following:
// - Add a new class name (of your choice) to the "Classes" array
// - Add another class.
// - Display the Teacher's Name
// - Display the Teacher's Classes
// - Display the full Teacher Object
let teacher = {
name: "Jonathan",
currTeaching : true
}
teacher.classes =[]
let arrayClass = {
asig1 : "Math",
asig2 : "History"
}
let arrayAlum = {
numAlum : 10,
}
teacher.classes[0] = arrayClass
teacher.classes[1] = arrayAlum
console.log('Teacher Name: ' + teacher.name)
console.log('Teacher Classes\n' + teacher.classes[0].asig1 + '\n' + teacher.classes[0].asig2)
console.log(teacher)
// teacher.classes.push("arrays")
// teacher.classes.push("objects")
//console.log