Answer the following questions about JavaScript. These questions may require you to do your own research to determine the best answer.
Developer Resources
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.
A variable stores a data value. For example, c = 2, and c is the variable, or g=12, and g is the variable.
var x = 10;
= 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 and 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).
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.
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.
A while loop executes a block of code as long as a certain condition is fulfilled.
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 not true. An else if statement runs a block of code when a specified condition is false and another specified condition is true.
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.