DEV Community

Saif Al Siam
Saif Al Siam

Posted on

#100daysofcode [ Day - 01 ]

100daysofcode [ Day - 01 ]

Today I've learned about Variables, Conditions & Function.
And I have made a function to Check Even or Odd Numbers.

Alt Text

Top comments (10)

Collapse
 
rbravo86 profile image
Richard Bravo

Well done, another option would be :

(( number % 2 != 0 ) ? "This is a Odd number :)" : "this is a even number :)")

Good luck with #100daysofcode :) Gotta have guts, be brave!

I'm looking forward to see your progress.

Collapse
 
briannarenni profile image
Brianna Renni

Want to clarify in case OP doesn’t know: this refactoring is using the ternary operator :)

(Condition) ? CodeIfTrue : CodeIfFalse

Collapse
 
alsiam profile image
Saif Al Siam

Thank you for your suggestions bro. I will definitely try it next time.

Thread Thread
 
briannarenni profile image
Brianna Renni

No problem, I was where you were not long ago, it feels good to be able to understand a concept enough to pass it on!

It also takes the stress from If Statements haha

Thread Thread
 
alsiam profile image
Saif Al Siam

yes bro! 😊

Collapse
 
alsiam profile image
Saif Al Siam

It's a great pleasure to talk with you . And thank you for giving suggestions to code in standard way. I think your code is more standard and more professional. thank so much bro . I will definitely try it now .

Collapse
 
alsiam profile image
Saif Al Siam

suggest me to Improve more!!

Collapse
 
alvaromontoro profile image
Alvaro Montoro • Edited

Congratulations on starting the challenge. Good luck and let us know if you need any help. We are here to support you if you need it :)

A suggestion to go beyond today's lesson: look at the differences between let, const, and var. Then consider: which one would fit better in today's code? and why?

Collapse
 
alsiam profile image
Saif Al Siam

thank you very much for your suggestions . It's a great pleasure to talk with you and next time I will definitely try to do code with let, const ❀️❀️

Collapse
 
yoshida profile image
Masao Yoshida • Edited

Congratulations to start your journey.
I think it would be good to know the difference between the operator != and !==.
You can find it here
w3schools.com/js/js_comparisons.asp