-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
80 lines (65 loc) · 2.59 KB
/
index.html
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<body>
<h1>Building Instances of Objects Using a Class</h1>
<script>
/*
PROBLEM 1: Create a class from the object below. Console.log the new student class or invoked test method to see the results printed to the console.
let student = {
name: 'Jessica',
grade: 'B',
year: 3,
test(){
return `${this.name} received a ${this.grade} on the test!`
}
}
*/
//ENTER YOUR CODE HERE
/*
PROBLEM 2: Use the dog object to create a dog class and instantiate a new dog named 'Lucy'. Console.log the new dog to see the dog class printed to the console.
const dog = {
name: 'Fido',
breed: 'Boxer',
age: 4,
bark(){
return 'bow wow!';
},
play(toy){
return `${this.name} loves playing with a ${toy}`;
}
}
*/
//ENTER YOUR CODE HERE
/*
PROBLEM 3: Create a phone class and instantiate a new phone named 'blueberry'. Make sure to include:
•An owner property that has a value of 'Steven'
•A model property that has a value of 'XM50'
•A calls property that has a value of 9
•A method named call that adds 1 to the calls property and returns 'I am making a call to (name) from my (model) phone'
Console.log the new phone instance to see the results printed to the console.
*/
//ENTER YOUR CODE HERE
/*
PROBLEM 4: Create a video game class and instantiate a new game named 'bionix'. Make sure to include:
•An genre property that has a value of 'Multiplayer RPG'
•A rating property that has a value of 4.5
•A players property that has a value of 2, but cannot be higher than 10
•A method named play that adds a number of players to the players property and returns 'There are (number) of players joining the game, bringing the total number of players to (players)'
Console.log the new video game instance to see the class printed to the console.
*/
//ENTER YOUR CODE HERE
/*
PROBLEM 5 (DEBUGGING): The following code defines a Book class. However, there is an "Uncaught SyntaxError: Unexpected identifier 'book' " error in the code that prevents it from running properly. Fix the code and create a new Book instance named 'magic'. Console.log the title and read method to the console to see the results printed to the console.
Class book = {
title: 'The magical Island';
author: Seymour Redding;
genre: 'fiction';
pages: 250;
read(number){
return `read ${number} out of ${this.pages}`;
}
}
*/
</script>
</body>
</html>