10 Things you need to know about JavaScript

Abed Hossain
3 min readMay 22, 2021
JavaScript Facts

Admit it or not, JavaScript has become one of the most popular programming languages all over the world. Though it had some flaws and shortcomings at the beginning, JavaScript is now widely used as front-end technology for a web application. It solved the gap between different operating systems (Windows, Linux). Also, this is the only language that works in both, client site and server site.

You may have decided to learn JavaScript by now. So, I would love to share 10 facts about JavaScript you should know.

1. Single-Threaded Language

JavaScript is a single-threaded language for both, client-site or server-site language. It doesn’t allow you to create a new thread. To compensate for that, JavaScript offers an event loop model and async feature which covers up for this shortcoming.

2. Everything is Object

JavaScript functions are considered objects. They have a dynamic habit in terms of flexibility. When you do the execution, adding or removing any property from the object is possible. Now, based on the point number two and three, it basically means you can add or remove functions from any objects during development. As soon as you make the changes, the object hierarchy will contain the new function in no time.

JavaScript objects are basically key-value pairs which is more similar to java hashMap.

3. Doesn’t have classes

JavaScript is an object-oriented language. But it doesn’t have any classes. Instead, it has prototypal inheritance which means one object inherits from another object.

4. No block scope in JavaScript

Most of the JavaScript syntax is like Java. However, one thing is not common here. It uses function instead of curly braces {} to define scope. JavaScript gives you the ability to declare a variable inside the function and access it from anywhere within that function.

5. Powerful functions

JavaScript comes with powerful functions to work with. Though, it is not similar to C++ or Java Functions. JavaScript functions are considered objects. You can assign these objects as method parameters.

There are many types of functions available in JS:
1. Global functions
2. Member functions (methods)
3. Nested functions (closures)

6. No linker, only Global Object

Instead of the linker, JavaScript offers a global object. All of your variables and functions come under the main object. Also, you have to be careful when declaring a global variable in the script file. If you have two variables in two files that contain a similar name, it can create some interesting bugs.

7. Same Origin Policy

If you are executing JavaScript on a page, it will be able to access data from any other page if it has the same origin or domain. By using the “SRC” attribute, developers can also fetch other files. This policy ensures that JavaScript code on your webpage will not make a call to an unknown third-party web server.

8. Advanced topics:

There are some advanced interesting code patterns and keywords related to JavaScript. Such as constructor patterns, module patterns, constructor stealing, mixins, hoisting etc.

9. Fewer syntax quirks:

If something goes wrong, JavaScript can give you both “UNDEFINED” or “NULL”. Also, you can have types of undefined and values of it. And if you miss semicolons at the end of the code, JavaScript will automatically add them.

10. JavaScript Tools that are useful:

If you work on JavaScript these are some awesome tools to make your work easy and efficient.

  • JSLint — It works as an Online compiler for JavaScript.
  • Charles web proxy — It provides local or remote mapping, and breakpoints (Mac and Windows on both the platform Charles proxy rocks!!)

So that’s it! Hope it was helpful and you have discovered some new facts about JavaScript. Happy coding.

--

--

Abed Hossain

Professional Web Developer and Digital Marketing Expert