<title>Leveraging Web Data Class 5 Homework Nava Rastegar</title>
<h1 style="text-align: center;"> Leveraging Web Data Class 5 Homework</h1>
<p>Answer the following questions about JavaScript. These questions may require you to do your own research to determine the best answer.</p>
<p>Developer Resources</p>
<li><a href="https://www.google.com" target="_blank">Google</a></li>
<li><a href="https://www.stackoverflow.com" target="_blank">Stack Overflow</a></li>
<li><a href="https://www.w3schools.com/" target="_blank">W3 Schools</a></li>
<li><a href="https://devdocs.io/javascript/" target="_blank">Dev Docs</a></li>
<h3>Append your name to the text between the title tags.</h3>
<h3>Describe the purpose of JavaScript, how might it relate to web mapping and visualization?</h3>
<p>JavaScipt is a programming language that allows interactivity to be built into a website. For any online map that is interactive or dynamic, JavaScript would likely be used. </p>
<h3>What is a variable? Provide two examples of using a variable.</h3>
<p> A variable stores a data value. For example, c = 2, and c is the variable, or g=12, and g is the variable. </p>
<h3>Write out how to assign the variable x equal to 10.</h3>
<h3>Describe the differences between =, ==, and ===.</h3>
<p>= sets a variable equal to a certain data value. == checks if two pieces of data are equal to one another and returns a true/false statement. === checks if two pieces of data are equal to one another <em>and</em> checks if they are also the same type of data. For example, '3' ==== 3 would return as false because '3' is a different type of data than 3 (text as opposed to numeric). </p>
<h3>What would be the result of "Hello " + 10? Why?</h3>
<p>The result would be "Hello 10" because the + signs conectates the values, since i is not a set value, but a variable, the computer does not run it as a value and allows the loop to happen. </p>
<h3>What is the purpose of a for loop? Describe in detail the advantages of using the for loop.</h3>
<p>A for loop executes a block of code a specified number of times. This allows a programmer to repeat a piece of code multiple times without writing out the code multiple times. </p>
<h3>Describe the while loop in JavaScript.</h3>
<p>A while loop executes a block of code as long as a certain condition is fulfilled.</p>
<h2>If/Else Statements</h2>
<h3>What are the three <a href="https://www.w3schools.com/js/js_if_else.asp" target="_blank">conditional statements</a>? Describe how each are used.</h3>
<p>The three conditional statements are if, else, and else if. An if statment runs a specified block of code as long a a particular condition is true. An else statement runs a specified block of code as long as a particular condition is <em>not</em> true. An else if statement runs a block of code when a specified condition is false and another specified condition is true. </p>
<h3>What is the difference between using two if statements together compared to using an if statement then an else if statement or else statement?</h3>
<p> Using two if statements forces the computer to run through each statement and check whether or not it is true before returning a result- writing if x=<2 then y, if x>2 then z, means that the computer would still have to check x = 1 with each statement, even though 1 is obviously less than two. Writing if x> 2 then y, else then z allows the computer to return the value without having to check each condition.</p>
<script type="text/javascript">
function myNewFunction(stop){
for(var i = 1; i < 101; i++){
if (i%3==0 && i%5==0) {console.log("Hello World")
} else if (i%3==0) {console.log ("Hello")
} else if (i%5==0) {console.log("World")