Learning JavaScript: Conditionals and Loops with Sheryians

Day 6 of Learning JavaScript  from Sheryians Coding School Today, I have learned about Conditionals and Loops.  Conditionals:   if: Inside this block, a condition is tested that returns true or false.   Falsy values: 0, "", NaN, null, false, undefined, document.all   Truthy values: Everything other than falsy values.   else: Executes when the if condition is false.   else if: Executes when the if condition fails, but another specific condition needs to be checked.  Ternary Operator:   condition? true: false  Switch:   Used to check multiple conditions.   You can create multiple cases inside a switch.   Each case runs when the passed condition matches the case value.   Always write a break after each case to stop further execution.  Loops:   There are two main types of use cases:   1. Straightforward loop: The value and printed result do not change.   2. Dynamic loop: Both the value and printed output can change.  For Loop:   for (start; end; change) { }   Used to repeat a block of code multiple times.   You can start the loop from any value, for example, 100, 1999, or 6778 in a straightforward loop.  #JavaScript #WebDevelopment #CodingJourney #LearningWithSheryians #ProgrammingBasics

Don't waste your time on "Noname Coding School" use this: https://javascript.info/

Like
Reply

To view or add a comment, sign in

Explore content categories