Day 2/100

Day 2/100

Today I covered control flows in javascript. Here I'm referring to if statements, if ... else, while loops, etc.

To consolidate the lessons, I solved simple exercises but most notable is the fizzBuzz and Demerit points exercise.

fizzBuzz is a function that accepts an input and if its a number divisible by 3 it returns Fizz, divisible by 5 it returns Buzz, divisible by 3 and 5 it returns FizzBuzz, not divisible by 3 or 5 it returns th number. Finally if the input is not a number, it returns "Not a number".

Demerit points acts as a speed detector. The function accepts the input as speed. If it's less than or equal to 70, you're safe. If it's above 70, you get a point for each 5 above 70. Finally you get your license suspended once you are 12 points and above.

PS: That's day 2 covered. For those of us that may find these difficult or confusing, let me now your thoughts in the comment sections. See you tomorrrow.

要查看或添加评论,请登录

Ifeanyichukwu Chimbo的更多文章

  • Day 4/100

    Day 4/100

    Today on the #100DaysOfCode challenge, I worked on Arrays and how to manipulate them. I was able to add and remove…

  • Day 3/100

    Day 3/100

    Today was an introduction to Object Oriented Programming(OOP). When functions are created inside objects they are…

  • Day 1/100

    Day 1/100

    Today I worked on the very basics of Javascript. But first I had to setup my development environment.

社区洞察

其他会员也浏览了