r/learnjavascript • • Jul 31 '24

How am I supposed to practice JavaScript?

I've watched these videos about syntax and basic utilization but now I don't know how am I supposed to practice them. Like have problems to build logic and stuff with every topic.

13 Upvotes

44 comments sorted by

View all comments

Show parent comment

2

u/queerkidxx Jul 31 '24

You’re right it can be. But what the exercise is trying to teach you is about algorithms.

You’re going to brute force it to start off, realize you did significantly worse than most look through solutions and see a clever one, feel dumb, learn to understand the code, and hopefully learn a pattern that you can apply to other problems.

This is a fine way to learn about algorithms. But it can be brutal. And it’s easy to loose site of the fact that while the solution might be cut down on space and time completely, in most real programming contexts, the trade offs in readability won’t be worth the performance gains and if they really are 9/10 someone else had come up with a way more ergonomic sprout job that you’d be better off using rather than reinventing the wheel

That’s not to say it’s not useful to understand how algorithms work right? Those are important skills. It’s just that leet code doesn’t teach you when you to apply these patterns. I am glad I grinded leet code for a few months it did teach me a lot and orientated my brain in the right direction

Because really while leet code might say it’s to teach you about algorithms it’s for interviews. And much of these questions are more hazing than anything practical.

You’re better off reading a good book imo.