showing results for - "js if condition"
Thimeo
05 May 2016
1if (condition1) {
2  //  block of code to be executed if condition1 is true
3 }
4else if (condition2) {
5  //  block of code to be executed if the condition1 is false and 
6  //  condition2 is true
7} else {
8  //  block of code to be executed if the condition1 is false and 
9  //  condition2 is false
10 }
Monica
23 May 2016
1if (condition1) {
2  //  block of code to be executed if condition1 is true
3} else {
4  //  block of code to be executed if the condition1 is false
5}
Francesca
23 Jan 2020
1const count = 20;
2
3if (count === 0) {
4  console.log('There are no students');
5} else if (count === 1) {
6  console.log('There is only one student');
7} else {
8  console.log(`There are ${count} students`);
9}
10
similar questions
queries leading to this page
js if condition