JavaScript Basics: A Beginner’s Guide

Why JavaScript?

JavaScript as an industry is booming, with major vendors like Microsoft, Google and Apple integrating JavaScript into their products. JavaScript is becoming the primary programming language used in web development, with web browsers driving the adoption of JavaScript to better enable the web itself to interact with user interfaces. JavaScript has become widely known as the JavaScript language, but it’s been around since the 1990s as a part of the ECMA specification (The Ecma International Consortium). In fact, the origin of JavaScript was taken from a project by Tim Berners-Lee at CERN (The European Organization for Nuclear Research).

JavaScript Fundamentals

JavaScript is a dynamic programming language built for the web. JavaScript is used to make web page interactive, to draw dynamic graphics, to create dynamic websites, and to do a lot more! JavaScript is also incredibly powerful — it allows developers to create virtually any type of application possible with a lot of the same code and very little code (this is something that is extremely helpful for UI developers). JavaScript introduces concepts from the functional programming world: Constant values — Remember when you learned how to multiply numbers and found yourself confused with the fact that they would get multiplied infinitely in both directions? JavaScript makes it possible to ignore the direction of the multiplication as long as the result is correct.

What is JavaScript?

JavaScript is a programming language, and as a language it is fairly complex. However, that complexity is in large part due to the fact that it provides developers with the tools they need to write high-level, rich, and complex client-side applications in a fairly short amount of time, using a small set of tools. There are two general approaches to how JavaScript works under the hood, and they vary based on the type of application being created. If the application is a very simple one that just displays a simple widget or contains a very simple database entry, JavaScript is not very exciting. However, a high-level web application with a rich and sophisticated user interface is usually created with a more powerful language. That language is often JavaScript.

JavaScript & the DOM

JavaScript is a scripting language that allows a browser (HTML5 or HTML4) to communicate with a hardware device such as a webcam, or a touchscreen. In HTML5, the scripting language is embedded in the HTML text document that is served by the browser to a particular web page. This is called the Document Object Model (DOM), which means it is an interface to the web page. Let’s see how the DOM works with a Java program. When you compile Java, it turns into a running program, but it is not a stand-alone executable. It is sent as an argument to the Java virtual machine, which does the heavy lifting and actually executes the program. In HTML, the DOM is a file that contains HTML code that talks to a device.

JavaScript & Events

The JavaScript programming language defines four basic operations: assigning an element to a variable; assigning a variable to an element; obtaining a value for an element; and deleting an element. Here is the code we’ll be looking at: var document = {}; document.addEventListener(‘DOMContentLoaded’, function() { var input = document.getElementById(‘movie’); input.onclick = function(e) { document.removeChild(input.anchor); }; document.addEventListener(‘DOMContentLoaded’, function() { var x = 0; = ‘none’; = ‘absolute’; document.getElementById(id) ||‘

JavaScript & Array

There are lots of built-in method in javaScript that helps us to do our task-related with the array. Like,

  • The “reverse()” method reverses the elements in an array.

const name= [“Robin”, “Shakil”, “Rubel”, “Abdul”];

  • You can find any array's length just by typing array. length:

const name=[“Robin”, “Shakil”, “Rubel”, “Abdul”];


  • You can push an element in array by using array.push():

const name=[“Robin”, “Shakil”, “Rubel”, “Abdul”];

const newName=name.push(“Ronaldo”);


  • You can remove an item from the end of an array by using an array.pop():

const name=[“Robin”, “Shakil”, “Rubel”, “Abdul”];

const newName=name.pop() ; then “Abdul will remove from array”


  • If you want to see a single array element in console,you can do it to console that element index number , like

const name=[“Robin”, “Shakil”, “Rubel”, “Abdul”];

console.log(name[0]); “You will see ‘Robin’ in console”


const name=[“Robin”, “Shakil”, “Rubel”, “Abdul”];

console.log(name[3]); “You will see ‘Abdul” in console”

JavaScript & Math

JavaScript for Fun

Now you may be thinking, I want to write some code, but it’s not that interesting. It’s the same as writing Ruby, or Python — I’ll be using a little bit of JavaScript, and that’s it. What could be so interesting about using a completely different language for anything besides writing some code? Well, one good thing about JavaScript is that it’s an interpreted language. That means that, by definition, it can be run on any device or operating system without the need for runtime infrastructure or drivers. In other words, you don’t need to spend a fortune to write your web application and launch it on a cheap phone.


JavaScript is a remarkable tool, an integral part of the web. There is a high degree of sophistication and thought put into the implementation, which makes you wonder how it could have become such an omnipresent, powerful tool in such a short space of time. JavaScript itself is so complex that it’s a wonder the web industry has been able to make it work for all the myriad of uses it is put to, and the general lack of understanding of how it actually works, for that matter, has had the side effect of making JavaScript more opaque to the average web developer, who doesn’t understand how a call to console.log() could eventually be used to print a line of code that returned: ‘Hello world’, This is just one of the many examples of the quirks of JavaScript.

Junior React Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store