You Know JavaScript but Can’t Solve Problems in It?



This content originally appeared on DEV Community and was authored by CodeGuage

Table of contents

  • Passive learning is worse than not learning
  • Alright but what is passive learning?
  • The solution to passive learning
    • Training
    • Spaced repetition
  • Embrace learning and make it active

It’s not uncommon for beginner JavaScript developers to often complain that they know the language sufficiently well but are, for some reason, not able to solve basic problems in it.

We frequently hear such statements from newbie learners on online JavaScript forums, such as those on Reddit, Quora, etc.

Now, this is just as saying that you know how muscle building works but when you try to lift a heavy weight, you’re not able to do so.

“Why?” you ask. Well simply because you’re not training enough!

Knowing how muscle building works is great but it won’t magically make you a body builder or a muscular person. Similarly, knowing JavaScript is great but that won’t make you in itself capable of solving any problem in it.

Problem-solving comes from training. From literally solving exercises.

And even with training, results don’t come overnight. It’s a constant and consistent effort that develops the mindset required to solve problems, utilizing all the knowledge that you posess.

Do you find yourself in a similar situation?

In this article, I hopefully aim to address this concern, if you’re facing it, and allow you to be able to confidently solve programming problems in JavaScript.

After all, if you know JavaScript well enough, then you should be able to use it. Right?

Passive learning is worse than not learning

Let’s begin with an important point I want to clear upfront.

If you’re into passive learning, stop right now! I repeat: STOP!

You’re much better off at not learning anything than spending your time learning passively. Seriously!

Now, here’s why I say this…

Time is key. Time is money. We all know that. Ain’t we?

When you spend this valuable resource of yours in passively consuming knowledge that actually needs to be applied, in a day or two, this knowledge start to fade away. Over the course of a week or month, ultimately, you are back to square one — knowing absolutely nothing!

You see the problem?

You expended a good amount of your time in consuming knowledge only to end up exactly at where you were before all of it!

Don’t you think it would’ve been better for you to have used this time to do something else? Something worthy of being exchanged with time.

And hence, my argument that passive learning is worse than not learning.

If you are passively learning, you need to stop immediately. Rethink your approach to learning that how you can get into “active mode” and start again.

Learning is amazing. No denying that. But passively learning is a silent time buster. You won’t even know and it would kill your most valuable resource.

I’ve learned this the hard way over the years and all I can do now is to prevent others from falling into the same learning trap.

Alright but what is passive learning?

I knew you’d ask this. It’s a genuine, logical question.

Let’s understand what exactly is it that I refer to passive learning…

Passive learning is when you’re learning, learning, and learning without actually exercising what you’ve learned.

Let me give you an analogy.

If you get into a typing class and learn all day long that pressing F and J marks the beginning of learning how to type, would that make you type F and J easily, without looking at the keyboard?

Just think about it for a moment. Certainly not, right?

Then how come just learning about JavaScript would make you a developer who can easily solve problems in it.

It doesn’t really make much sense, if at all!

Going more specific, passive learning is learning what data types are in JavaScript, how arrays work, how numbers work, what closures are, what prototypal inheritance means, and so on, all without ever getting a hands-on experience of using some of these concepts to solve real problems.

Actually, a symptom of passive learning is when you’re not able to make sense of the purpose of given concepts.

For example, if you can not make sense of closures, you’ve probably never ever solved problems that need them. Because if you did so, you would’ve known the utility of closures in JavaScript.

Further reading:
Try solving the exercise JavaScript Functions — Euclidean Distance to leverage the concept of closures.

As they say “Nothing is without purpose” and it’s only when you solve problems putting forth that purpose that you get to appreciate it.

The solution to passive learning

So now that you know what exactly passive learning is and not to do it at all (you got it, right?), let’s find out what to do instead.

Obviously, I’ll use JavaScript as the basis for this because that’s the point of this article but you can even apply the ideas discussed here to other programming languages (or just about anything).

Training

As I stated earlier, to become a problem-solver, you don’t need knowledge. Instead, you need knowledge that’s used.

Said another way, you need training.

So how do you train yourself as a JavaScript developer to be able to solve problems?

By solving problems! Simple, isn’t it?

However, the problems must start off simple and increase in difficulty, slowly and gradually, as you are allowed the time to get more comfortable solving the basic ones.

And now, let’s get down to where to find these problems.

Actually, I’ve been working for quite a long while trying to make a collection of exercises for JavaScript that can help you apply a huge variety of concepts throughout the language in solving real problems.

For example, shown below are some of the relatively challenging exercises from this collection that require some solid expertise on JavaScript:

(If you identify yourself as an expert JavaScript programmer, see if you can easily solve the aforementioned exercises.)

If you’re a complete beginner, learning JavaScript, I recommend that you start off with the very first exercise, JavaScript Foundation — Quick Print, which is extremely trivial to solve but gets you started in your problem-solving-mindset-building journey.

Of course, just as I said earlier, you won’t become this in one day. Dedication and consistency is what paves the path to becoming this.

If you’re an intermediate-level, kind of experienced JavaScript developer, it still won’t hurt to start off from point zero. After all, you’re not learning from point zero but only solving problems from point zero.

And believe me, the sense of being able to neatly solve a given problem hits differently. It’s like achieving a huge milestone, even if that milestone turns out to be just setting up a basic for loop.

Spaced repetition

Just like learning on its own would take you only so far, training would also take you only so far!

“What? Are you serious?” Oh yes, I am serious.

It isn’t difficult to prove this point.

As highlighted earlier, if you know a lot about muscle building, that won’t magically help you become a fit, muscular person. We agree on this. You need to train to become such.

But just going to the gym once in your entire lifetime and lifting weights that single day won’t make you muscular either.

You need to consistently hit the gym and then wait for results!

A common misconception is that solving programming problems makes you an ingenious problem-solver. Well, it sure does but only for a couple of minutes, or hours, while you are in the moment of trying to solve the given exercise.

In a week or so, you might have to fight with yourself again to solve that same exercise.

Quite weird but it’s true!_To become a _real problem-solver, you need to consistently hit the deck, solving the same exercises time and time again. This does two things:

  • You start developing muscle memory for typing out code.
  • Your minds start to find patterns in problems, because you are exposed to the same problems over and over again.

These two things don’t come by if you just solve problems once and for all.

The phenomenon where you do the same thing over and over again, with breaks in between, is referred to as spaced repetition. It is actually a thing in the science of learning.

Further reading:
To learn more about this phenomenon, head over to Spaced repetition — Wikipedia.

As an example, if you solve, let’s say, JavaScript Arrays — Binary Search today, then you should try solving it again after a week, then again maybe after two weeks or so, then maybe after a month or so.

Each time you attack the problem, you’ll notice your mind approach it in different ways. Sometimes, you’ll make more intuition out of given conditionals, sometimes you’ll focus on the initialization of variables, and so on.

Repetition is active learning in itself!

So even when you have a collection of problems to solve using JavaScript with you, the trek isn’t over. It’s your job now to solve those problems and then solve them again after a while, and again, and again, and…you get it.

Which problems to solve again of course depends on their difficulty.

The more challenging ones need more iterations compared to the easier ones until you are superbly comfortable with what they have to offer.

Embrace learning and make it active

I want to end this article on the note that if you have the curiosity of learning in you, that’s a fantastic thing to have. I urge you to unleash this learning potential of yours!

But… and you know what’s coming now, don’t you? Let’s review it together

But know that this recommendation comes with an attached warning: keep from doing all of this passively.

No matter what you’re learning in tech — AI/ML, microservices, system design, agile/scrum, cloud computing, APIs, security, or just about anything — before diving into learning, do give a minute of thought on how would you be removing passivity from it.

For instance, maybe you decide to practice developing an app using microservices while learning about it. Or maybe you decide to write what you’re learning about APIs on your social account.

In any case, you have a plan made to make the most our of your learning. You’re not just learning; you’re putting that learning into action.

That’s vital. That’s crucial. That’s integral.

Because, believe it or not, no matter how good you think you know something today, without putting aside the passivity in your learning, I guarantee you’ll forget 99% of it in a very short period of time.

All in all: Keep learning, and learning actively!


This content originally appeared on DEV Community and was authored by CodeGuage