Answer the following questions about JavaScript. These questions may require you to do your own research to determine the best answer.
Developer Resources
JavaScript is a powerful and popular language for programming on the web. D3.js is a JavaScript library that offers powerful data visualization features for producing dynamic, interactive data visualizations in web browsers.
JavaScript variables are containers for storing data values.
A string variable is a series of characters like "John Doe".
variable as a number, for example: var x = 34;
var x = 10
A single equal operator is used to assign a value to a variable
When a comparison is made using a double-equals operator, it will check the values of a variable and convert them to a common type and returns true if both are equals. So comparing number with a string having the same value will return true.
for example: console.log(23 == "23"); // true
In contrast to double equals operator, another operator with three equals not made the implicit conversion so it not only compare values but also the type of variable that's why it is also called strict comparison.
for example: console.log(23 === "23"); // returns false
The result for 10 is "Hello" because 10 is divided by 5 and the remainder of operation is equal to zero.
For loop is used to run the same code over and over again, each time with a different value.
The while loop loops through a block of code as long as a specified condition is true.
The if statement specifies a block of code to be executed if a condition is true
The else if statement specifies a new condition if the first condition is false
The else statement specifies a block of code to be executed if the condition is false
In our example the loop number (15) has to be divided by 3 & 5 to meet the first condition(execute "Hello World"). If we use if (i % 3 == 0), else if (i % 5 == 0), the first condition would be executed for 15 ("World") and the program would not check the second condition.