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

Discussion (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
briannaxrene profile image
briannaxrene

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 Author

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

Thread Thread
briannaxrene profile image
briannaxrene

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 Author

yes bro! 😊

Collapse
alsiam profile image
Saif Al Siam Author

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 Author

suggest me to Improve more!!

Collapse
alvaromontoro profile image
Alvaro Montoro • Edited on

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 Author

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 on

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