6 topics to upgrade your JavaScript skills

emdadul hoque
4 min readNov 3, 2020

JavaScript is the language of web development. All web developers must be good at JavaScript. Today I discuss some important topics which are helping a web developer to upgrade his/her skill. let’s start

1) Error handling

All web developers are very careful when writing code. As if there is no error in the code. But sometimes an unexpected user input can occur an error this crashes a program. Don’t worry JavaScript has a weapon to protect our code from unexpected user input. The weapon is try…catch statement. let’s see..

The try statement lets you test a block of code for errors. If any kind of error happens in try statement, the catch statement handles the error.

2) Comments

An important sign of a good developer is comments. Good comments allow us to maintain the code well, come back to it after a delay and use it more effectively. Let’s discuss some good and bad comments…

i) Good Comments

Good comments provide a high-level overview of components and function usages. how they interact, what’s the control flow in various situations. let’s see an example

ii) Bad comments

Bad comments are those tell “how code works” and “what it does”. let’s see an example

3) Coding Style

We often hear code must be human-readable. In this section I discuss
How to make code human-readable. let’s start.

i) A space between parameter, curly brace on the same line, No space between the function name and parenthesis

ii) Space after for/if/while, Space around operators, Semicolon is mandatory

iii)An empty line between logical blocks, else { without a line break, Spaces around a nested call

4)Local variable declarations

  • Declare all local variables with either const or let. Use const by default, unless a variable needs to be reassigned. The var keyword must not be used.
  • Local variables are not habitually declared at the start of their containing block or block-like construct. Instead, local variables are declared close to the point they are first used (within reason), to minimize their scope.

5) Do not use the variadic Array constructor

6) cross-browser testing

A good JavaScript developer should know about cross-browser testing. let’s discuss it…

what is cross-browser testing?

Cross-browser testing is the practice of making sure that the web sites and web apps you create work across an acceptable number of web browsers. As a web developer, it is your responsibility to make sure that not only do your projects work, but they work for all your users, no matter what browser, device, or additional assistive tools they are using. A javascript developer need to think about:

  1. Your web app must run on different devices with different capabilities. it will be latest tablet, smartphone, smart tv. So you should write your code sincerely.

2.People with disabilities, who use the Web with the aid of assistive technologies like screen readers, or don’t use a mouse (some people use only the keyboard).

--

--