More Javascript Concepts

Md Mustafizur Rahman Sayem
4 min readDec 21, 2021

Truthy and Falsy values-

As a javascript developers, we always need to understand the basics of programming and logic. Like what should return from an object, array, or function. This will make to realize our mistakes and we can smoothly build and run the application as expected.

Falsy Values-

  • False
  • -0, 0 (zero),(BigInt,zero)
  • ‘ ‘ , “ “ , ` `, (empty string)
  • null
  • undefined
  • NaN

Truthy Values-

  • ‘0’ (a string with a zero), ’false’ (a string with text false)
  • [ ] (empty array), { } (empty object)
  • function( ) { } (empty function)

window, global variable, global scope-

We know how scope is worked in javascript. Like global, local /function, Block scope.

So when a javascript variable is declared outside of the function it means the variable is in a window object so this object is a global variable, also one can say the variable is in the global scope so it can be accessed from any function.

this keyword-

“This” keyword actually refers to the object from where we are calling. It has different values depending on where it is used

Method= this refers to the parent object

others(Alone)=this refers to the global object

Prototypical inheritance-

Prototypical inheritance is actually an inheritance technique where the inheritance is quite different than regular inheritance. So that in application let’s say we have a user and it has objects and method and properties. And now we want to make the user interface slightly changed in terms of methods or objects or properties like giving the users the role of admin. Here we just reuse the user so prototypical inheritance makes it so easy like making an object on the top of this useful function. So we just reused the whole thing from users.

Call stack, event loop, and call back queue-

We already know how javascript works using stack and callback queue. So unless and until the call stack is empty or not the event loop will work as the first event loop in the queue and push it to the call stack, then it executes the event. So this happens every time in the call stack and callback queue.

Event delegate in js-

If we want to handle events efficiently then the concept comes Event Delegation. Instead of adding every event and every element, we can add an event listener to its parent or root element. And then we just use the dot target property of the event to access that.

JSON and its use cases-

JSON full form is javascript=JS, Object=O, Notation=N. So it means the data are been saved as an Object so that this object can be accessed by programming languages like Javascript. So if we want to send data to the server or web application we can send the data in a JSON format. Also, we can retrieve those JSON data whenever we want it, we just fetch those JSON data and we can extract information from that JSON.So JSON makes it easy to send and receive data in a specific format.

Javascript does these things two ways with these two built-in javascript functions. We all know that.

JSON strings into Javascript Object =JSON.parse()

Javascript Object into JSON string =JSON.stringify()

The purpose of API, GET, POST-

We know that API is an application programming interface. Which is used for interacting external data to an application. This API makes it easy for handling HTTP requests and fetching information for an application. The most used HTTP API method for data fetching and extracting is GET and POST.

Webpack, Babel-

Babel is called a transpiler for javascript version ES5 and ES6. The main reason for transpiler or babel is so that browser can understand javascript code.

On the other hand, webpack is a bundler for JS which actually makes files as a compact bundle so that it can be the downloadable format for users.

That’s all for today.

Thank you

MD MUSTAFIZUR RAHMAN

Support me at Youtube:https://www.youtube.com/channel/UCU_GV9uLrxHl4-1WkTPzr1g

Linkedin:https://www.linkedin.com/in/md-mustafizur-rahman-sayem-22b856156/

Github:https://github.com/rahmancoder

--

--