JavaScript if else | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

JavaScript if else

How exactly that works?

16th Apr 2019, 1:12 AM
Pedro Gadelha
3 Answers
+ 9
If-else is condition based boolean thing This have 2 blocks of code, one in if condition another in else. if(2<3){ console.log('2'); } else{ console.log('3'); } The condition with 'if' is checked, if the condition(I.e. 2<3) is true, the if block will be executed, if it false, then else block will be executed... https://www.sololearn.com/learn/JavaScript/1137/ //you should start the JS code😅
16th Apr 2019, 1:22 AM
Jaydeep Khatri
Jaydeep Khatri - avatar
+ 1
If statement you allows to perform a bloc instructions whether a condition are valid or not.
16th Apr 2019, 1:23 AM
Mamoudou Sylla
Mamoudou Sylla - avatar
0
Thank you
16th Apr 2019, 1:24 AM
Pedro Gadelha