What should every javascript programmer know




















Git stats commits. Failed to load latest commit information. Added new Github Action for checking links. Apr 19, Initial commit. Sep 4, Nov 1, Oct 29, View code. Call Stack Reference Articles Videos 2. It does not matter if you are working on frontend or backend, the first year or so, you will probably default to console.

To write good applications, you definitely have to change that and replace your lazy logs with nicely handled errors. You may want to check out how to build your own Error constructor and how to catch them correctly, as well as showing the user what the actual problem is.

Similar to moving through your application continuously, you have to decide where to group specific information chunks and where to keep them separate. This does not only apply to building database models, but also function parameters and objects or variables.

This is a very important aspect of JavaScript, Either you are fetching data from the backend or you are processing requests asynchronously in the backend itself. In pretty much all usecases, you will encounter asynchronity and its caveats. If you have no idea what that is, you will probably get a weird error, which you will try to fix for a couple of hours.

This is an interesting topic. Normally it is somewhat left out in the day today life as a developer. Maybe you learned jQuery and never felt the need to pick up some native DOM manipulation skills, maybe you are just using a frontend framework, where there is rarely a need for custom DOM manipulation.

However, I think this is a crucial part of understanding JavaScript, at least in the frontend. Knowing how the DOM works and how to access elements gives you a deep understanding of how websites work. In addition, there will be the point where you have to do some custom DOM manipulation, even when you use modern frontend frameworks, and you definitely do not want to put jQuery in your package. Even as a frontend developer, you should know the basics of node. Ideally, you would also know how to spin up a simple express server and add some routes or change existing ones.

JavaScript is great for writing scripts to help you automate a lot of tasks. Therefore, knowing how to read files, work with filepaths or buffers gives you a good toolset to build anything.

There is an everlasting debate about functional vs. You probably can achieve the same thing with both of the approaches.

In JavaScript, it is even easier, you have both of the approaches available. You need to learn how to debug slow processes and understand where the problems are coming from. For browser environments in particular there are some baseline things to understand. This is also an area where learning more about Computer Science theory can be beneficial. Studying data structures and algorithms can help give you good intuitions on how to handle data, and learning about Big O notation gives you a language for discussing performance tradeoffs.

This is the type of background knowledge that pays off in occasional subtle ways though, not something that is always obvious applicable in the moment. There are also a lot of different technologies that fall under the umbrella of JavaScript, more than any one person can keep in their head.

Ideally this means having at least one place where you can follow news about new JavaScript innovation. Could be Twitter, a set of blogs, newsletters or an aggregator site like Reddit or Hacker News. You also need to get comfortable finding information about specific technologies, either to learn to use them or troubleshoot problems. This can be explained at several levels, but its good to at least know that a request is sent from the users computer to a server somewhere, and that server returns resources like HTML, CSS, JS, and image files.

The List 1. You should know the core language JavaScript is not a very complicated language at its core. You should understand async code One of the biggest leaps for new JavaScript developers, even those who are experienced with other languages is the amount of asynchronous code found in idiomatic JavaScript.

You should get comfortable with at least one set of developer tools When developing JavaScript, its important to be able to debug problems and understand how existing systems work.

You should be proficient with JavaScript functions Functions are the core of the JavaScript language. You should be comfortable with Node. The only downside of a forEach is that you cannot break the loop.

If you want to create a loop using ES5 syntax, there is Array. The while loop is similar to a for loop, except it only accepts one argument and that is a statement that equals true or false. So if you remember earlier we have three conditions for our for loop, this would be condition 2. While loops are generally regarded as the fastest form of loop, that is debatable.

In my experience the fastest kind of while loop is a decrementing while loop in which you take a value and subtract from it until you hit zero which is falsey. You should know what the do while loop does even if you will never use it. Meaning if you supply an expression to your while loop that equals falsey then it will not run.

A while loop executes its condition before the loop begins, the do.. Hence why a do.. The loop runs, the expression is checked and then so on. Once again the Mozilla Developer documentation has an excellent articles on most of the loops touched upon here. There are basic methods in Javascript you really should be aware of. From working with arrays to strings, Javascript contains a treasure chest of useful methods. We only touch upon methods for working with strings and arrays in this post, not objects or any other kind of value.

If you want to read more on working with various types of data in Javascript, the Mozilla Developer documentation is a nice and concise site for learning more about various methods. Obviously some people will have opinions on whether or not you should know all of these and perhaps some I have left out. My memory can only stretch so far, but here are a few I think most developers should know. Knowing how to manipulate strings efficiently is an essential skill in my opinion.

In Javascript with exception of maybe working with arrays and objects, you will find yourself working with strings probably quite a bit.

During day-to-day development, I find myself working with arrays a lot. They serve as a great way to store data, to keep track of states and using them as maps generally.

I think knowing how to do basic tasks with arrays is an essential skill for a Javascript developer to have. Things you should not have to really Google. There are other methods for working with arrays not listed here which you should definitely read upon further. There are some exciting new methods that were added in ES6 not listed here and other array methods that go into more specific use cases. These two methods are misunderstood and intimidate a lot of developers.

While it is possible to go without using call or apply, they are especially handy because they allow you to call methods and change what the context of the this value is during execution. The difference between the two is only subtle, but there is a difference. Using the call method will allow you to provide infinite comma separated arguments when calling a function.

Using the apply method will allow you to call a method using an array as the supplied arguments. The method is great if you want to use an array as arguments on a method call as well as change the context of this. If you are just wanting to use an array of values as arguments on a function, ES6 comes to the rescue in the form of a spread operator. The new additions to ES6 mean there are really limited instances where we will need to use call or apply in the future.

Thanks in part to spread operators , arrow functions and the ability since ES5 to use bind. There are of course millions more, but these are the biggest and currently most popular in my opinion. As web applications grow in complexity, these frameworks and libraries make our lives easier. It is not unreasonable to expect that a Javascript developer in should know at least one framework or library other than jQuery.

Without-a-doubt Node. Because Node. You will find you spend more time configuring packages you are using in your apps than you do learning Node.

I personally think Node. I am not talking overly complex in-depth knowledge of it, but enough to use it for local development server instances, prototyping, testing and other use-cases where Node. The language has grown inherently complex thanks in part to front-end frameworks like AngularJS and server side Javascript in the form of Node. As Javascript evolves and code-bases swell as we use it for more and more things, testing becomes important, if not vital. My favourite test runner is definitely Karma.

There are plenty of others to consider, but Karma is especially great for testing AngularJS applications. Being a Javascript developer in means knowing how to use task runners, transpilers, profilers and other tools we have at our disposal to write the best Javascript code possible.

Sometimes you need to use a dedicated tool to get more detailed information about the inner workings on your application. Gone are the days of downloading a single Javascript file and including it into our page. These days package managers like NPM and Bower are used in place of manually downloading scripts. We combine and minify scripts using task runners, test using separate tools and things are generally more organised.

Javascript tooling goes hand-in-hand with the likes of writing isomorphic Javascript shared code-base between the server and front-end. Even though browser support still has a while to go before most of the good parts of ECMAScript 6 are supported, we can use transpilers to start writing ES6 code today.



0コメント

  • 1000 / 1000