Learn JavaScript (Tutorial 3)

preview_player
Показать описание
Presented by: Aakash Biswas

Duration: 27.21 minutes

Data Types

JavaScript has different data types  that can hold different types of values. There are two types of data types in JS.

Primitive data type
Non-primitive data type

JavaScript is a dynamic type language, which means that you don't need to specify the type of the variable because it is dynamically used by JavaScript engine. 

JS Primitive Data Types:
1)String
2)Number
3)Boolean
4)Undefined
5)Null

JS non-primitive data types:
1)Object
2)Array
3)RegExp

Conditional Statements

In JavaScript we have the following conditional statements:

1) If  statement to specify a block of code to be executed, if a specified condition is true

2) Else  statement to specify a block of code to be executed, if the same condition is false

3) Else if  statement to specify a new condition to test, if the first condition is false

4) Switch  statement to specify multiple alternative blocks of code to be executed

The JavaScript Switch Statement
Use the switch statement to select one of many blocks of code to be executed.

The break Keyword
When JavaScript reaches a break keyword, it breaks out of the switch block.
This will stop the execution of more code and case testing inside the block.

The default Keyword
The default keyword specifies the statement to run if there is no case match.
Рекомендации по теме