DEV Community

Cover image for Javascript: The trend!
Unnati Bamania
Unnati Bamania

Posted on

Javascript: The trend!

If you’re curious about programming in 2021 and still confused with programming languages. Please read this article completely.
JavaScript is one the most trending and fast-growing languages in 2020.

Alt Text
Just have a look on this annual survey of Stack overflow. Results say that 70% developers use JavaScript.
Done with all analytical parts. Now as a developer student or a learner how can one start with JavaScript. Let’s run through and quick and short guide on how to begin with JavaScript.

The Basics:

Like every other programming language, one has to learn all the basics like data types, variables, loop, conditional statements, array methods, string methods etc.

Data types in JavaScript:

  • Number
  • String
  • Boolean
  • Undefined


The loops are as follows:

  • for loop
  • while loop
  • forEach loop


Conditional Statements are used to check conditions. The syntax mostly involves if else statements and switch statements, ternary operators.
Alt Text


Arrays are the special variables which can store more than one value at a time.

Some important Array functions in JS:
  • Push: Add element to end
  • Pop: Delete element from end
  • Delete: Delete an element from index
  • Splice: insert in between by deleting some elements
  • Concat: concatenate 2 array
  • Slice: Getting data from some index to other index
  • Sort: Sorting array
  • Reverse: Reversing the order of array


Some of the important String methods:

  • IndexOf: Gets index of a word in array
  • Slice: Gets content from one index to other
  • Search: Gives the index of given word
  • Substr: Gets the substring from specified index
  • Replace: replaces a word
  • Split: splits by the given character Alt Text

Functions & advanced array methods:

Functions in JavaScript are declared with the keyword function

Arrow Functions:

One of the most popular JS topics. It is a very powerful method.
It allows us to write short syntax.

Some of the advanced array methods:

  • Filter: Mostly used to remove some data by mapping it in a function
  • Map: Maps the array with function
  • Reduce: Mostly used with accumulator to perform mathematical operations

Alt Text

OOP (Object Oriented Programming):

JS supports OOPs methodology.

Some terms related are:

  • Class: Structure for creating objects
  • Constructor: It is a function called by itself when objects are declared.
  • Inheritance: When one class inherits the properties from other class. The keyword extends is used there.
  • Instance: It is a kind of variable of class. It is declared by using new class_name()

Alt Text

DOM Manipulation:

With HTML DOM you can change or manipulate any HTML element in JavaScript
We can access HTML elements using document keyword in JS.


  • getElementById: selects element with specified id
  • querySelector: selects element with any id, class or tag name
  • getElementByClassName: selects elements with specified class name.

There are a lot other DOM methods but mostly used ones are specified here

Event Listener:

We can add event listener to perform some action when something is done. For example, start timer when button is clicked hence we can can add click event listener to it.

  • click: on clicking the element following function runs.
  • mousemove: Following action takes place when mouse moves.

There a lot of other event listeners only some are mentioned here.

Alt Text

JavaScript has a lot of other powerful concepts to learn like closures, iterators, generators. It also supports asynchronous methodology using callbacks, promises, async & await. Some other topics to explore are AJAX and JS JSON.

Some Vanilla JS DOM manipulation projects:

Beginner Projects:

  • Simple calculator
  • Form validation
  • Api fetch
  • Spock and rock.

Intermediate projects:

  • Quiz
  • Hangman
  • Typing game
  • Speech text reader
  • Unit converter
  • Navbar animations
  • Bookkeeper.

Advanced projects:

  • JS game
  • Drag and drop

Tutorial references:

Modern JS from beginning by Brad Traversy on Udemy

Link to the course

Javascript web projects: 20 projects to build your portfolio

Link to the course

20 Web Vanilla JS projects

Link to the course


There’s a lot more you can do with JS. There are a lot of frameworks for front and back end development. Frameworks like NodeJS, ReactJS, VueJS, AngularJS and a lot more. One can opt to become a MERN/MEAN/MEVN stack web developer. One of the coolest guide by Nitin Ranganath MERN Stack Guide on MERN stack technology.
If you want to build mobile applications React Native is there to fulfil that demand as well. Alright, now comes desktop applications, you can also build desktop applications using Electron JS. I agree ML is the future, here you’ve tensorflow JS for ML and AI. Now you see the scope of this programming language. I hope JS is your choice for programming in 2021.

Top comments (13)

michaelcurrin profile image
Michael Currin

Thanks for sharing.

Pro tip - use .map instead of .forEach since it is 3x faster and returns an array and not undefined.

const letters = ["a", "b", "c"]

const upper = => x.toUpperCase())
// [ "A", "B", "C" ]
Enter fullscreen mode Exit fullscreen mode

Using forEach but more verbose.

const letters = ["a", "b", "c"]

let upper = []
letters.forEach(function (x) {
    const u = x.toUpperCase()
// [ "A", "B", "C" ]
Enter fullscreen mode Exit fullscreen mode
shadowtime2000 profile image

This isn't that true at all. First of all, you can rewrite the forEach example to this:

letters.forEach(x => {
Enter fullscreen mode Exit fullscreen mode

which isn't that verbose. Also .map is pretty slow compared to .forEach because it creates another copy of the array while .forEach will just iterate over the current array.

michaelcurrin profile image
Michael Currin • Edited

That is more verbose for the extra brackets and extra 2 lines plus the extra line needed before for. So overall it takes 4 lines like that instead of 1.

let upper = []
Enter fullscreen mode Exit fullscreen mode

Yes creating a copy uses more memory but that doesn't make it slower because the implementation of .map is faster.

Also the link you shared is not conclusive. Out of 4 times I ran tests, on 2 occasions forEach was faster and on 2 occasions map was faster.

Thread Thread
michaelcurrin profile image
Michael Currin • Edited

One article i found said .map is faster and another said .forEach is faster (and for was slower than both)

Also though this article doesn't test .map, it makes an observation that what you do inside the loop makes a difference. Some approaches handle small operations better, some handle more operations and data structures better

Anyway the speed doesn't seem the advantage I thought but using .map is superior for chaining effectiveness and brevity. => request(url))
  .map(resp => resp.json())
  .filter(data => data.fizz > 2)
Enter fullscreen mode Exit fullscreen mode

If you do any Functional Programming you'll also appreciate chaining Arrays and functions over more unpredictable state as objects that get modified at multiple points in a for loop or multiple for loops

Thread Thread
mubashirmohamed647 profile image

It just comes down to preference, and usage. Whether you want to iterate over the array or just want an array with all the results is entirely up to you. If, for instance you have an array of numbers, and you want to add them all, then use it for your app. You can use the map method there to get a new array. If, however you no longer need the old numbers, you can just use the forEach method to iterate over the array. But, if you want to iterate or not, when it does not make any difference, it all comes down to preference.

Thread Thread
michaelcurrin profile image
Michael Currin


You can also use for...of, which doesn't take a function like map or forEach

for (const x of myArray) {
Enter fullscreen mode Exit fullscreen mode
mubashirmohamed647 profile image

Thank you for sharing. This is a great starter article for anyone.

itsnitinr profile image
Nitin Ranganath

Fantastic guide for beginners to get started with JavaScript! Thanks for sharing.

commentme profile image
Unnati Bamania

You're welcome

ameybhavsar profile image
Amey Bhavsar

A good article to refer basics. Thank you for sharing!

commentme profile image
Unnati Bamania

You're welcome

indrysfa profile image
Indry Sefviana

wow it's great, thanks for sharing

commentme profile image
Unnati Bamania

You're welcome!