Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 14, 2022 09:17 am GMT

Conditional statements and loops Practices in Javascript.

challenge

Youll learn :
More about conditional statements if, if else and switch and get better with using them the right way, also youll learn when and how to chose one loop statement over others.
Conditional statements :

1/ Check a number is even or odd :
Image description

2/ Find the largest between two numbers :
Image description

3/ simple switch code

Image description

3.5/ Switch code

Image description

4/ Simple calculator with if else :
Image description

5/ Simple calculator with switch :
Image description

Loops :
1/ Print the summation of numbers between 0 and 10 :
Image description

2/ Write a code to print numbers from 1 to 10 :
Image description

3/ print only even numbers between 0 and 20
Image description

4/ simple while loop :
Image description

all in one example :
Image description

References :
https://www.programiz.com/javascript/while-loop , https://www.learn-js.org/en/Loops , https://education.launchcode.org/intro-to-professional-web-dev/chapters/loops/exercises.html , https://www.programiz.com/javascript/for-loop

Thanks for reading, and feel free to ask any question about javascript or about this series and i appreciate any feedback to improve My content.
find me on twitter, github and my portfolio.


Original Link: https://dev.to/osam1010/conditional-statements-and-loops-practices-in-javascript-3i1n

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To