Interesting JavaScript Topics we should know

Murad Hossain
3 min readNov 3, 2020


Primitive Values: All types except objects can not be modified after creation are primitive values.


console.log(“this is”);


Primitive types: string, number, bigint, boolean, undefined, symbol, null.

Functions and Objects are not primitive. They can be modified after creation.

console.log({ });

console.log(x => x * 4);

Expressions: Expressions are questions that JavaScript can answer. If we ‘ask’ expressions 3 + 3. JavaScript will ‘answers’ with the value 6.

console.log(3 + 3); // 6

The special nature of expressions is it always results in a single value.

Checking a Type: Using typeof Operator we can check the value’s type.

console.log(typeof(3)); // “number”

console.log(typeof(“abc”); // “string”

console.log(typeof(undefined); // “undefined”

JavaScript Call Stack: A call Stack is a mechanism for an interpreter to keep track of its place in a script that calls multiple functions.


function add(a, b){

return a + b;


function average(a, b){

return add(a, b) / 2;


let x = average(20, 6);

Error handling “try..catch”: try..catch that allows us to ‘catch’ errors, it has two main blocks: try and catch.

try {

// code …

} catch (err) {

// error handling …


First, it executed the code inside try {..}. If there were no errors, it ignores catch(err){..}. If found an error then the try execution is stopped and execute the catch(err){…}. Here err variable will contain an error object with detail about what happened.

Style Guides: A style guide contains general rules on how to write code with the best codding style.

Some popular choices:

Comments: Comments can be single-line: starting with // and multiline: /* … */.

We normally use them to describe how and why the code works.

Bad Comment:

// Comment with multiple lines….

// … additional lines of comments


Good Comment:


* Comment on multiple lines …

* Second line

* More line



Caching: Caching is a useful and surprisingly complex feature of web browsers. All browsers attempt to keep local copies of static assets in an effort to reduce page load times and minimize network traffic.

Different types of caching:

  • Client Caching
  • Server Caching
  • Local Caching
  • Hybrid Caching.

Cross Browser Testing: This is a process to make sure that the website or web application is to work across an acceptable number of web browsers.

Cause of cross-browser issue:

  • Implement features differently.
  • Some browser has a different level of support for technologies.

Four phases of testing: Initial Planning -> Development -> Testing -> Fixes.

Block Level Declaration: In a block-level declaration, variables are inaccessible from the outside of the given block scope.

Block scopes are created:

  1. Inside of a function
  2. Inside of a block (indicated by the { and } characters)

Default Parameters: allow named parameters to be initialized with default values if no value or undefined is passed.

function multiply(x, y = 2) {

return x * y;


console.log(multiply(3, 4));

// expected output: 12


// expected output: 6

Arrow Function: is a compact alternative to a traditional function expression. But it has some limitations.

  • Should not be used as a method.
  • Does not have its own bindings to ‘this’ or ‘super’.
  • Can not be used as Constructors.
  • Not suitable for ‘call’, ‘apply’ and ‘bind’.



Murad Hossain

MERN Stack Developer. Make web and mobile application.