0

Best practice examples? JavaScript Boolean

//so I want to practice control flow error handling , If I were to run this code what would I replace the condition, statement, runs with any tips or advice? I already wrote it down in my notebook now I’m looking for example code to write and I’m using a reference as well but I’m still pretty new .. appreciate fb! if (condition) { statement_1_runs_if_condition_is_true; statement_2_runs_if_condition_is_true; } else { statement_3_runs_if_condition_is_false; statement_4_runs_if_condition_is_false; }

21st Sep 2021, 5:36 PM
Anthony Oliveri
Anthony Oliveri - avatar
2 odpowiedzi
+ 2
say you have a variable called age and it has the value 30. If age is greater or equal 18, you console log "You are adult!". If this condition is not true, you console log "You are underage!". This could be a use case of if-else statement
21st Sep 2021, 6:35 PM
Lisa
Lisa - avatar
0
Lisa very helpful that you explained it like this thank you!!!
21st Sep 2021, 6:36 PM
Anthony Oliveri
Anthony Oliveri - avatar