I can't tell you enough, how much I am starting to get JavaScript after four weeks of tutorials, reading, challenges, and games! This really was a ...
For further actions, you may consider blocking this person and/or reporting abuse
I think you can do better with the birthday song. Why not use a loop to 4 instead of 2 and use an IF-THEN-ELSE construction to print the different line on the count of 3.....
Apart from that: happy coding :)
If-then-else? How about picking up another technique, the ternary operator?
while (i < 4) {
let message = (i ==3) ? "Happy Birthday dear " + name + "," : "Happy Birthday to you.
";
document.write(message);
i = i + 1;
}
Which isn't the end of ways to refactor this. You could get rid of the temporary variable by having the ternary inside the document.write(), and you could change the while loop to a for loop. There's almost never only one way to do something when it comes to programming.
This is great! Thanks for building on this code and showing me another way to write it! I'm learning so much.
Nice! I didn’t think of that! Thanks so much for pointing that out. That’s great advice and I’ll keep that in mind for improvement. 👍🏼
No one understands JavaScript:
res.cloudinary.com/practicaldev/im...
Haha. You’re absolutely right!!
That feeling is what you need to be a programmer. I can tell you, after 30 years of programming, it never left me. As long as you follow your passion(s) and are not trapped with job requirements/clients you don't like but are forced to work on. Then its pure work.
That feeling is the most importsnt requirement. After that, you only need time (a fun time!). No degrees, no fancy hardware, no big companies.
That's exactly what I want! To not feel like I'm doing something that I'm forced to work on but actually enjoy. And I think I found it in programming. What I'm learning is getting very exciting!
Great work! I was in your position not too long ago. Still learning now.
I am also a visual learner and I really like puzzles. So, I spent a lot of time on Codewars, which helped expose me to loads of different methods. Though, it won't teach you anything about the DOM.
Keep us updated! :)
I really like puzzles too. I’ll check that out. It’s always great to see one problem many different ways. Thanks for the suggestion!
I’ll definitely be taking the time to read it! Thank you for sharing your article!
Sounds more like understanding programming in general than just understanding javascript. Good luck with your learning :D
It just felt like figuring one thing out was a gateway to understanding all that’s programming. Haha. What a rush! Thanks for the luck! My brain appreciates it!
I am happy for you.
Thank you so much!
Head First books are sooo good. I highly recommend anyone to look through their line up for a book on a subject of interest. They're phenomenal at teaching.
It was a very good read! There were many times when I thought I wasn't going to get a concept and Head First just explained it so easily!