DEV Community

Thomas Pikauli
Thomas Pikauli

Posted on

When Javascript first clicked for me

I vividly remember a time before I knew how to write Javascript. I could do HTML and CSS, and maybe drop in the occasional JQuery snippet, but as soon as I saw variables or functions, I looked away in disgust. What was this unintelligible flurry of letters, symbols and numbers.

For years I ignored the hell out of it. And as long as my ambitions didn't surpass making a nice little website or setting up a blog, I was okay. There were a few times that a tutorial here or there lured me into stuff like Ruby on Rails or some other programming thing. But they usually scared me away as soon as they stopped describing every single thing I should do in absolute detail.

But I knew this behaviour could not go on. If I was serious about trying to make a living on the web, I should learn this Javascript language. If I really wanted to make an app, there was no going around it. So I made an ultimate attempt.

Me laughing in pain
Me back when I tried to read programming books for the first time and I kept laughing very insecurely about all the 95% of text I didn't understand.

In reality this meant I did a combination of trying to read Javascript books (didn't click), reading blog posts (small click), watching a colleague of mine write advanced code (interesting, but no real click) and watching video tutorials (big click!).

For me the starting point of finally grasping what was going on was understanding the function. Somehow functions, arguments, parenthesis, parameters and returns confused me. How could that be, right? It's not like there are multiple ways to define a function...

But once I settled on manipulating my mind into thinking there is only one true way to define a function, I made a second mental step. I started to think about a function as a little set of instructions the browser carries out whenever you call it.

It made sense to me. And in the early phase of learning, that's really all that matters.The next question was what kind of instructions I could give to that function. And to whomst I would give those instructions.

Query selectors appeared to be part of the answer. It turned out (I think I saw this first in one of the Wes Bos videos), you could grab one of your HTML elements by their ID. You can then save that element as a variable, which you are very free to name how you want it.

But the real breakthrough happened when I learned about console.log and the browser console itself. I really can't overstate how important this revelation was to me.

Because now I could just trial-and-error things: hmm, now my variable is empty and now it has some sort of value. Just by being able to play around and get direct feedback I became able to predict what would happen when I did certain things.

And when you grasp just enough to get results, things start to become fun. So when I got my variables filled up, I was now ready to actually have my function do things with them. Manipulate their whole being, if you will.

That exact moment is when some bits of the reading I did crawled back into the forefront of mind. I could identify my variables held different types of data, and that based on that I could do different things. There were arrays, strings, numbers, etc.

All I had to do was console.log often enough and I could figure out with a bit of Googling what kind of methods were at my disposal. Not too say that all was well now in my mind or that I felt like a real programmer, but it was about the first time that I actually believed I could learn all this programming stuff. Or however I thought about programming back then.

It were those mental leaps that were necessary for me to not give up. Without any technical background the world of programming can be quite daunting, if only for all the lore and stigma that the word has. But when a couple things start to click, and you realize it's challenging, but not impossible, you can really start learning.

Now, when I speak to someone I never tell them that programming is hard or only for #thenerds. I always say it's just another skill you can learn. Like accounting, skateboarding or drawing. And if they are truly interested I refer them to YouTube. Just go watch people build things, explain things and see if that's something you want to do yourself.

In retrospect, it was watching videos of other people code that really helped me when I was still at the phase of being completely clueless. The combination of seeing the result of what someone was doing with live commentary was just super effective to me. Books and blogs only helped me at a later stage.

So this was the start of my grand journey. When did things first .click() for you?

Top comments (0)