-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodingChallenge4.html
More file actions
51 lines (44 loc) · 1.28 KB
/
codingChallenge4.html
File metadata and controls
51 lines (44 loc) · 1.28 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
<!--CODING CHALLENGE 4-->
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
/*task 1:
create an obj named car, assign properties/attributes to it.
in the js cose, try to change one of the attribute of the obj
*/
car = {
color: 'Red',
price: 5600,
brand: 'BMW'
};
car.brand = "Toyota";
document.write(car.brand);
/*task 2:
create an obj named car, assign properties/attributes to it.
in the js cose, try to change one of the attribute of the obj
*/
function display() {
document.write("Hi there");
}
/*task 3:
create a car obj with a propery called state, create a button
and use js code to make the button change the state of the car
*/
function start(){
Car2.state = "Started";
document.write(Car2.state);
}
Car2 = {
color: 'Red',
price: 5600,
brand: 'BMW',
state: 'Stopped'
};
</script>
<button onClick="display()">Click here</button>
<button onClick="start()">Click here to start</button>
</head>
<body>
</body>
</html>