Javascript library for beginners

Hi all!
I started learning JS on my own about a month ago.

While there are many tutorials explaining how to build simple programs like a clock or slightly complicated animation, it feels like copying them is not very productive.

Seeing the many built-in properties/methods/functions, I am struggling to understand how do programmers know (or better yet, feel) which ones to use when programming? Is it necessarily done by googling for answers? Going over entire library entries seems crazy and utterly time consuming, but does it actually have to be done that way?

I feel like this is a common issue, no matter which programming language one starts to learn. I hope you would kindly try to remember your early programming days and advice on a more efficient method to code.
There is no need to link me for books or tutorials- I am truly interested in hearing out your personal tips and experience.

Thank you for your replies! :slight_smile:

Whereas most languages have a ‘standard library’, Javascript gets a lot of it’s additional functionality from the browser APIs. Here is a list of them: https://developer.mozilla.org/en-US/docs/Web/API

I’ll go out on a limb and say that nobody knows all of them - most people won’t even use most of them, but some of them - like ‘window’ and ‘document’ - you will probably use a lot.

Then there are the built-in methods on the native objects - like all the array methods: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array

You’ll pick these up over time and (if you’re anything like me) at some point you’ll struggle over the solution to some problem, only to realise later that there’s a built-in that ‘just works’. Frustrating. But you’ll remember the next time :wink:

If you’re already using a text-editor it’s a good idea to install the ‘intellisense’ tools for it (Atom uses tern.js iirc and VS Code, which I just switched to, seems to have it all built in: https://code.visualstudio.com/Docs/languages/javascript). This scans the code you’ve already written and tries to work out what types your variables are so that if, for example, you type the name of an array, followed by a period/full stop, it gives you a list of all the array methods to choose from. It’s a very quick way to jog your memory about what’s possible.

Some of the methods that I use regularly, I still have to look up basically every day (eg; slice/splice) because I can never remember the order of the parameters. MDN (mozilla developer network) is the best place to go - I search 'mdn + '. I also have http://devdocs.io/ installed in Chrome which you can use to keep an offline copy of all the docs.

2 Likes