filmov
tv
JavaScript if statement | JavaScript if else statement - JavaScript Tutorial 33
![preview_player](https://i.ytimg.com/vi/njGIrhoROOs/maxresdefault.jpg)
Показать описание
Notes for You:: JavaScript if statement
- Browser executes true part of the if statement;
- if the given conditional expression evaluates to true.
syntax:
if(conditional expression) {
statements; // true part
}
JavaScript if else statement:
- Browser executes true part of the if else statement;
- if the given conditional expression evaluates to true;
- else it executes the false part.
syntax:
if(conditional expression) {
statements; // true part
}
else {
statements; // false part
}
Note:
- if true part gets executed then false part don't get execute, vice versa.
Example code:
var a = 20;
if(a == 10){
}
else{
}
Output:
a is not equal to 10
=========================================
Follow the link for next video:
JavaScript Tutorial 34 - Ternary Operator vs. if else Statement in JavaScript
Follow the link for previous video:
JavaScript Tutorial 32 - Control Statements in JavaScript
=========================================
JavaScript Tutorials Playlist:-
=========================================
Watch My Other Useful Tutorials:-
jQuery Tutorials Playlist:-
jQuery UI Tutorials Playlist:-
Bootstrap Tutorials Playlist:-
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial
- Browser executes true part of the if statement;
- if the given conditional expression evaluates to true.
syntax:
if(conditional expression) {
statements; // true part
}
JavaScript if else statement:
- Browser executes true part of the if else statement;
- if the given conditional expression evaluates to true;
- else it executes the false part.
syntax:
if(conditional expression) {
statements; // true part
}
else {
statements; // false part
}
Note:
- if true part gets executed then false part don't get execute, vice versa.
Example code:
var a = 20;
if(a == 10){
}
else{
}
Output:
a is not equal to 10
=========================================
Follow the link for next video:
JavaScript Tutorial 34 - Ternary Operator vs. if else Statement in JavaScript
Follow the link for previous video:
JavaScript Tutorial 32 - Control Statements in JavaScript
=========================================
JavaScript Tutorials Playlist:-
=========================================
Watch My Other Useful Tutorials:-
jQuery Tutorials Playlist:-
jQuery UI Tutorials Playlist:-
Bootstrap Tutorials Playlist:-
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial
Комментарии