More JavaScript concepts to know

Exceptions -

Coding is something that is not definite. This means it is very unlikely to smoothly run through all the way to the output unless you are exceptions. Every developer, programmer faces error while developing something. While getting errors you must be out of your mind after seeing a bunch of lines in red, indicating something you are almost unaware of. There comes Error handling to gently handling all the error and make a statement about what exactly the problem is about. Almost every modern language has these exception terms handled in the same way and JavaScript is indifferent to it.

Coming to JavaScript, exception handling is just like traditional:

Catch -The catch statement lets you handle the error.

Try -The throw statement lets you create custom errors.

Finally — The finally statement lets you execute code, after try and catch, regardless of the result.

Event Loop -The Event Loop is a queue of callback functions. When an async function executes, the callback function is pushed into the queue. The JavaScript engine doesn’t start processing the event loop until the code after an async function has executed.
Theoretically, event-driven programming is application flow control that is based on events or changes in state.

Caching

The act of keeping data in storage to allow retrieval without having to request the data from the original source, if that data will not change frequently.

A typical caching scenario is having a cached copy of a web page. That page doesn’t change every five minutes, so caching it locally on your computer saves time and bandwidth for you to re-display it if you hit reload in your browser.

The cache is generally much faster than loading from disk or having a server generate a page from scratch. There are many other caches such as a database cache, or a disk cache, that speed up access for all kinds of events.

Client-Side Caching — Client-side caches are usually used to avoid transferring the same data over the network repeatedly.

Server-Side Caching — Server-side caches are generally used to avoid making expensive database operations repeatedly to serve up the same content to lots of different clients.

Javascript primitive and non-primitive datatypes

Primitives — Primitives are known as being immutable data types because there is no way to change a primitive value once it gets created.

var string = ‘This is a string.’;string[1] = ‘H’console.log(string) // ‘This is a string.’

Primitives are compared by value. Two values are strictly equal if they have the same value.

Non-primitive values are mutable data types. The value of an object can be changed after it gets created.

Objects are not compared by value. This means that even if two objects have the same properties and values, they are not strictly equal. The same goes for arrays. Even if they have the same elements that are in the same order, they are not strictly equal.

Non-primitive values can also be referred to as reference types because they are being compared by reference instead of value. Two objects are only strictly equal if they refer to the same underlying object.