JavaScript is the world's most popular programming language. JavaScript is the programming language of the Web. JavaScript is easy to learn.
Using var , Using let , Using const , Using nothing
A JavaScript function is a block of code designed to perform a particular task. A JavaScript function is executed when "something" invokes it (calls it).
Very often when you write code, you want to perform different actions for different decisions.
You can use conditional statements in your code to do this.
In JavaScript we have the following conditional statements:
Use if to specify a block of code to be executed, if a specified condition is true Use else to specify a block of code to be executed, if the same condition is false Use else if to specify a new condition to test, if the first condition is false Use switch to specify many alternative blocks of code to be executed
Use the switch statement to select one of many code blocks to be executed.
Loops are handy, if you want to run the same code over and over again, each time with a different value.
Often this is the case when working with arrays: #The While Loop The while loop loops through a block of code as long as a specified condition is true.