Leveraging Web Data Class 5 Homework

Answer the following questions about JavaScript. These questions may require you to do your own research to determine the best answer.


Developer Resources


Basic

Append your name to the text between the title tags.


Describe the purpose of JavaScript, how might it relate to web mapping and visualization?

JavaScript is created to enable work or chages to be done within the user's web browser , even when offline.It's ability to be used in creating high responsive interfaces and dynamic funtionality makes it convenient to be used for web maps designs and visualization


Variables

What is a variable? Provide two examples of using a variable.

A variable in JavaScript is a container that stores data values.

A value is assigned to a specific container and can then be referenced by naming the particular container

For example, in order to declare variables for data values 'song' and 'year', var song; var year;


Write out how to assign the variable x equal to 10.


Operators

Describe the differences between =, ==, and ===.

= assigns a value to a variable

== means equal. Checks if two values are equal or not

=== means equal value and equal type. Checks if two values are equal and have the same data type


What would be the result of "Hello " + 10? Why?

Hello10

Because adding a number a string returns a string as a result


Loops

What is the purpose of a for loop? Describe in detail the advantages of using the for loop.

A for loop repeats an action for some number of times until a condition evaluates to false

It is versatile and easy to use and able to handle all manner of looping tasks


Describe the while loop in JavaScript.

The while loop evaluates the condition and if true,the block of statements following the while statement is executed


If/Else Statements

What are the three conditional statements? Describe how each are used.

1. The if statement- Its the most common type and used to specify a block of code to be executed if a condition is true.

2. The else statement- This is an extension of the if statement wnd adds another block of code to run when the condition of the if statement is false

3. The else if statement- It is used to specify a new condition if the first condition is false.It extends an if statement byadding another condition with its own block


What is the difference between using two if statements together compared to using an if statement then an else if statement or else statement?

Multiple if statements may be used instead of else or else if statements. By using multiple if conditions,JavaScript has to go through each condition, whereas with else and else if conditions, JavaScript has to check conditions until it finds a condition that returns value to be true.


loop iteration number 0
loop iteration number 1
loop iteration number 2
loop iteration number 3
loop iteration number 4
loop iteration number 5
loop iteration number 6
loop iteration number 7
loop iteration number 8
loop iteration number 9
loop iteration number 10
loop iteration number 11
loop iteration number 12
loop iteration number 13
loop iteration number 14
loop iteration number 15
loop iteration number 16
loop iteration number 17
loop iteration number 18
loop iteration number 19
loop iteration number 20
loop iteration number 21
loop iteration number 22
loop iteration number 23
loop iteration number 24
loop iteration number 25
loop iteration number 26
loop iteration number 27
loop iteration number 28
loop iteration number 29
loop iteration number 30
loop iteration number 31
loop iteration number 32
loop iteration number 33
loop iteration number 34
loop iteration number 35
loop iteration number 36
loop iteration number 37
loop iteration number 38
loop iteration number 39
loop iteration number 40
loop iteration number 41
loop iteration number 42
loop iteration number 43
loop iteration number 44
loop iteration number 45
loop iteration number 46
loop iteration number 47
loop iteration number 48
loop iteration number 49
loop iteration number 50
loop iteration number 51
loop iteration number 52
loop iteration number 53
loop iteration number 54
loop iteration number 55
loop iteration number 56
loop iteration number 57
loop iteration number 58
loop iteration number 59
loop iteration number 60
loop iteration number 61
loop iteration number 62
loop iteration number 63
loop iteration number 64
loop iteration number 65
loop iteration number 66
loop iteration number 67
loop iteration number 68
loop iteration number 69
loop iteration number 70
loop iteration number 71
loop iteration number 72
loop iteration number 73
loop iteration number 74
loop iteration number 75
loop iteration number 76
loop iteration number 77
loop iteration number 78
loop iteration number 79
loop iteration number 80
loop iteration number 81
loop iteration number 82
loop iteration number 83
loop iteration number 84
loop iteration number 85
loop iteration number 86
loop iteration number 87
loop iteration number 88
loop iteration number 89
loop iteration number 90
loop iteration number 91
loop iteration number 92
loop iteration number 93
loop iteration number 94
loop iteration number 95
loop iteration number 96
loop iteration number 97
loop iteration number 98
loop iteration number 99