-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht4-javascript-basics.html
More file actions
90 lines (67 loc) · 3.19 KB
/
t4-javascript-basics.html
File metadata and controls
90 lines (67 loc) · 3.19 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html>
<head>
<title>ruthbai blog</title>
<meta charset="UTF-8">
<link href="style/main.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
<div style="text-align: center"><img src="website logo.png" height="150" width="150" /></div>
</header>
<nav>
<ul >
<li><a href="index.html">Home</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="CARD SLIDER.html">contact</a></li>
</ul>
</nav>
<div class="box">
<h3>
How does JavaScript compare to HTML and CSS?
</h3>
<p> HTML is the most basic and essential block to build website and css adds design to the elements that would
show up on website. Compared to that Javascript is not essential since you can build website with html and css
but still JS is like cherry and icing on the cake it will actually let website do much more cool things such
as text disappearing when you click on them..JS will let things get animated when the website loads.
</p>
<h3>
Explain control flow and loops using an example process from everyday life, for example 'waking up' or 'brushing your teeth'.
</h3>
<p>
Control flow is part of the way that logic works in javascript. If you explain control flow in everyday life..
it is like cooking a pork steak on a pan. Logically you can't eat raw pork meat so you would have to cook this
until it is fully cooked.
First you create a variable for pork steak and it is uncooked. If this condition is met
something will happen but because eating raw meat is impossible we will log the word not ready. underneath if statement
we can write another condition called 'else' we will log the word ready to this. In our case else is applied
when the meat is cooked. Going back to the first variable that we have created when you changed var pork steak = "uncooked";
to var pork steak = "cooked"; now because it meets the condition for else this will return 'ready'.
loops is simple. It is like programming to tell computers what to do. When you programme this loop statement computer performs same
task over and over again until a set of criteria are met. This loop statement will allow the pork steak to cook on the pan until
the meat is fully cooked.
</p>
<h3>
Explain the difference between accessing data from arrays and objects
</h3>
<p>
Array is subclass of object and it gains all features from object. Object normally explains detailed stuff of the object for instance
Name: Sam, Animaltype: dog, Likes: water, playing and array could be dog,cat,bird etc. When you are accessing an array you can access it based on its
position using numbers [0,1] and you can use the key of the key value pair to access the property assigned with the object.
</p>
<h3>
Explain what functions are and why they are useful.
</h3>
<p>
If else statement is quite commonly used function when you layout multiples of values and answers. Switch would do exactly same thing
but it would let cases break when they meet the requirement. Both of them are useful I think.
</p>
</div>
</div>
</ul>
</header>
<footer>
<div style="text-align: center"> Devs academy</div>
</footer>
</body>
</html>