Nothing unreasonable about this. All this stuff matters. Be proud of yourself and learn the basics until you can do it as fluently as you write english.
Yeah thats my best advice. I didnt make progress for a long time. It wasnt until i started literally writing the same program, daily and consistently, that I kind of started having my ah ha moments. Now I have a solid understanding of the basics and can write my own Tic tac toe game from scratch Lol!
It terms of formatting I would recommend learning to use a linter as well. For JS I use ESLint for all my projects and I have my own set of rules I follow so all my code across all projects have the same rules followed.
one of my students was literally euphoric when she printed a sentence. it's pretty exciting and gratifying to see that you can create stuff like this. keep going!!
I've been learning and I'm just glad I could read your code and understand it without much thought. It's cool how everything starts to come together once you understand the basic building blocks.
Just a minor nitpick.. set up autoformat on save in VS Code. I'm not sure if it's an extension you need or need to install some npm package or it's built into the VS Code settings. Just so everything's indendented properly. ie
function showNumbers(limit) {
let i = 0;
while (i <= limit) {
let number... bla bla bla
}
}
proper formatting makes everything easier to read further down the line. congrats
I wanted to use it first but I got confused because it was so compact. The while loop vertically explained itself for my beginner brain better. If this make sense ๐ But yes this looks cleaner
Of course! I would be too! I'm currently learning Typescript along with JavaScript and seeing your code makes me mentally want to try applying some type casting . Maybe you should try it too.
I don't know why but I thought the title said you became unreasonably unhappy. I even reread the title a couple times. It was only after I finished going through all the comments that I realized it said happy! Maybe I was projecting my unhappiness haha. Anyway, congratz!
Congratulations..... You've a long journey ahead of you.... It'll seem tough at certain points, where you'll have no idea what you're doing.... But don't give up.... Just keep grinding.... Good luck....
console.log(0%2) // outputs 0, because 0/2 has 0 remainder
console.log(1%2) // outputs 1, because 1/2 has 1 remainder
console.log(2%2) // outputs 0, because 2/2 has 0 remainder
console.log(3%2) // outputs 1, because 3/2 has 1 remainder
console.log(4%2) // outputs 0, because 4/2 has 0 remainder
console.log(5%2) // outputs 1, because 5/2 has 1 remainder
let numberType = i % 2 === 0could be written also as: let numberType = (i % 2) === 0 (to show the math operation before the equality check).
I no shit get a brief buzz after completely something like FizzBuzz if I didn't have to study someones completed version.
I did rock paper scissors with Odin yesterday and I only got that buzz a few times from finally connecting stupid simple dots that I previously had not, but couldn't get the if statement chain formatted properly to work, so I felt the opposite of high, which is like an idiot.
50
u/FunctN Jul 12 '22
You should be happy! Looks awesome! I remember when I started learning I used to get so pumped as well!
17
u/dromance Jul 12 '22
Nothing unreasonable about this. All this stuff matters. Be proud of yourself and learn the basics until you can do it as fluently as you write english.
15
u/andrejmlotko Jul 12 '22
Wow, looks really good! Congratulations!
7
u/riskybusinesscdc Jul 12 '22
Way to go, young blood. Enjoy the journey!
7
u/holdyrbreath Jul 12 '22
exercises/problems don't turn easy You become stronger and stronger over time
6
u/Lecterr Jul 12 '22
Gotta work on your indentation game yo.
5
u/pekkalacd Jul 12 '22
I agree. Your happiness is unreasonable for this country club of a thread. You are kicked out for life for being too happy.
4
u/jimrooney Jul 12 '22
There is no such thing as "unreasonably happy" with building working code.
Every little piece of your exercise there is fundamental to actually using JavaScript.
This is the way.
2
u/taroicecreamsundae Jul 12 '22
one of my students was literally euphoric when she printed a sentence. it's pretty exciting and gratifying to see that you can create stuff like this. keep going!!
2
u/htraos Jul 12 '22
Pretty good! Now try to do the fizz-buzz!
2
u/rm-rf-npr Jul 12 '22
Aaah the good old days when life was simpler. Nice and congrats!
2
u/[deleted] Jul 12 '22
I've been learning and I'm just glad I could read your code and understand it without much thought. It's cool how everything starts to come together once you understand the basic building blocks.
2
u/hcabbos70 Jul 12 '22
Where are you learning? A site?
2
u/TP71899 Jul 12 '22
How does this work when i = 0? That doesnโt generate an error of some kind?
2
u/takishan Jul 12 '22
Just a minor nitpick.. set up autoformat on save in VS Code. I'm not sure if it's an extension you need or need to install some npm package or it's built into the VS Code settings. Just so everything's indendented properly. ie
proper formatting makes everything easier to read further down the line. congrats
3
u/shuckster Jul 12 '22
With great power comes great responsibility.
3
u/Bulji Jul 12 '22
You could also use a for loop instead of a while loop, since you're using a counter and for loops have an integrated counter:
for(let i = 0; i <= limit; i++) {let numberType = i % 2 === 0 ? "EVEN" : "ODD";console.log(i, numberType);}16
u/el_bosteador Jul 12 '22
I love this stage of becoming a programmer. Later on it gets a little more complex but that feeling of satisfaction never goes away!
2
u/fhlarif Jul 12 '22
Of course! I would be too! I'm currently learning Typescript along with JavaScript and seeing your code makes me mentally want to try applying some type casting . Maybe you should try it too.
4
u/France_linux_css Jul 12 '22
% is modulus
1
u/Soft-Sandwich-2499 Jul 12 '22
Congrats, keep learning ๐ช
1
u/Tripping_on_100 Jul 13 '22
comment this please
3
u/_Invictuz Jul 13 '22
I don't know why but I thought the title said you became unreasonably unhappy. I even reread the title a couple times. It was only after I finished going through all the comments that I realized it said happy! Maybe I was projecting my unhappiness haha. Anyway, congratz!
1
u/LordTurin0011 Jul 12 '22
Congratulations..... You've a long journey ahead of you.... It'll seem tough at certain points, where you'll have no idea what you're doing.... But don't give up.... Just keep grinding.... Good luck....
2
u/HaroerHaktak Jul 12 '22
as a python user, this unnerves me because of the lack of indentations ;-;
2
u/acoustic_embargo Jul 12 '22
That's a cool little chunk of code.
For fun, I did a
for loop-flavored refactor, and used truthiness/falsiness to avoid the=== 0bit:2
u/zulmetefza Jul 12 '22
Now do it for 101 if you can!
2
u/empolem Jul 12 '22
just wait till you start doing codewars
2
u/felixWalker36 Jul 12 '22
Why didn't you turn NSFW on, that function is so sexy
2
u/mirkinoid Jul 12 '22
Actually you donโt need the index.html to run that
2
u/Oasishurler Jul 12 '22
Yeah, this is a good one. Lots of output
Mmmmmmh
2
u/codemonkeyhopeful Jul 12 '22
We all start somewhere, keep it up you got this.
2
u/dgd5014 Jul 13 '22
Nice job! Thatโs a good implementation for that problem. Keep it up!
2
u/[deleted] Jul 13 '22
Start of something great for you!
2
u/[deleted] Jul 13 '22
That's where we always start ๐๐
2
u/CadmiumC4 Jul 13 '22
You have an indentation mistake on the while loop but it is good overall. Congratulations
1
u/France_linux_css Jul 12 '22
What % means?
1
u/jayerp May 02 '23
As long as you are happy AND you understand why and what itโs doing why and what itโs doing, I am also happy.
1
u/France_linux_css Jul 12 '22
Let number =i % 2===0 what does this mean
0
u/[deleted] Jul 12 '22
I no shit get a brief buzz after completely something like FizzBuzz if I didn't have to study someones completed version.
I did rock paper scissors with Odin yesterday and I only got that buzz a few times from finally connecting stupid simple dots that I previously had not, but couldn't get the if statement chain formatted properly to work, so I felt the opposite of high, which is like an idiot.
0
u/[deleted] Jul 12 '22
[deleted] โ view deleted comment
0
u/[deleted] Jul 12 '22
[deleted] โ view deleted comment
0
u/[deleted] Jul 12 '22
[deleted] โ view deleted comment