D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
jordanmccutcheon
Full window
Github gist
levereging_web_data_class5_final_McCutcheon_jordan
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Leveraging Web Data Class 5 Homework Jordan McCutcheon</title> </head> <body> <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> <br> <p>Developer Resources</p> <ul> <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> </ul> <br> <h2>Basic</h2> <h3>Jordan McCutcheon.</h3> <br> <h3>Describe the purpose of JavaScript, how might it relate to web mapping and visualization?</h3> <p>JavaScript is a programming language that helps with the performance, manipulation and user interaction of web pages. JavaScript can be its own file or embedded in a HTML file. JavaScript can be used in in web mapping and visualization for processes such as creating buttons and changing the color of the maps text. This will help enhance the visual appeal of your web map.(Class 5, Slide 10) </p> <br> <h2>Variables</h2> <h3>What is a variable? Provide two examples of using a variable.</h3> <p>A Variable is used in JavaScript to hold values. One example is when you want to give value to a string such as a person’s name. You can use the following variable Var Name = “Jordan McCutcheon”; You can also create a variable with simple math. Var Y = 3 + 5 +7+9; You can also use a variable to combine two string values together. ( source, https://www.w3schools.com/js/js_variables.asp) </p> <br> <h3>Write out how to assign the variable x equal to 10.</h3> <p>var x = 10;</p> <br> <h2>Operators</h2> <h3>Describe the differences between =, ==, and ===.</h3> <p>The = value assigns a value. (X =5) then x is 5. The == values checks if a value is equal to another value. (x==5) is only true of x = 5. The === is the same as == but it also must share the same type. If value 1 is a string for it to be === to value 2, value 2 must also be a string and have the same value as value 1. (source https://www.w3schools.com/jsref/jsref_operators.asp ) </p> <br> <h3>What would be the result of "Hello " + 10? Why?</h3> <p>Due to concatenation, the result would be Hello 10. Concatenation will add an operator with a string. (source, slide 31) </p> <br> <h2>Loops</h2> <h3>What is the purpose of a for loop? Describe in detail the advantages of using the for loop.</h3> <p>Loops are useful when you want to run the same script repeatedly with a different value. A for loops is used when you want to repeat up to a certain value or a certain number of times, saving the user time. When creating a for loop, make sure you have an endpoint, or the code will run until it crashes your system. (source, slide 25, 26, 27, and, 28)</p> <br> <h3>Describe the while loop in JavaScript.</h3> <p>In JavaScript a while loop goes through a block of code until a specified condition is met. Then the script will stop, and the user will get their results. (source https://www.w3schools.com/js/js_loop_while.asp) </p> <br> <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 if statement is used to show which code should be run when met with a specific condition. The else statement is used to show which code should be run when a specific condition is false. The else if statement is used to create a new if statement when the first one is false. (source, https://www.w3schools.com/js/js_if_else.asp) </p> <br> <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>When using two if statements if the outcome of the first one meets the condition of the second statement it will make the second statement true. When using an else if statement only the if or the else if can be true not both. When using an else statement only the if or else can be true not both. (source, https://stackoverflow.com/questions/4636191/is-there-any-difference-between-using-multiple-if-statements-and-else-if-stateme) </p> <br> <script type="text/javascript"> // // code goes below this line function myNewFunction(){ var i; var z=101; for(i=1; i<z; 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");} else{console.log(i); }; call.myNewFunction();} </script> </body> </html>