Basic JavaScript

Sarwar Putul
3 min readMay 8, 2021

JavaScript is a client-side scripting language or browser scripting language. Client-side scripting means the browser will run or execute the scripting. JavaScript borrowed many things from JAVA especially the syntax. Today I will talk about some basic JavaScript topics.

  1. Truthy and Falsy: All the numbers and string are truthy value except 0 and (“”) Empty-string. Empty Array[] and Empty Object{} is also truthy value. On the other hand undefined, Null, NaN is always falsy value. And interestingly false is also a falsy value.
  2. Undefined and Null: If there should be a value but there is no value assign, in that case, JavaScript provides the result undefined. If undefined is provided as a value then the result will become as undefined. On the other hand, if you make the value empty then JavaScript will provide the result Null.
  3. (==) and (===): Double equal(==) in JavaScript don’t check the type of value. It(==) check only the value, the value can be a string or a number, double equal does not filter the type. On the other hand Tripple equal(===) always check the typed string or number.
  4. Hoisting: Bring anything upper level after the declaration is called Hoisting. For example, after variables declared with var in a function can get output from outside of the function.
  5. Closure: If I call or return a function from another function then it makes a close environment. The function which is being called or returned if this function uses a variable outside from the function, at that moment they create their own closed environment that is called closure.
  6. Window, Global variable and Global scope: Window Is a JavaScript working area. Everything can be accessed by using window in JavaScript. That’s why it is also called global scope. And Global variable is that type of variable which is declared outside of the function and can use inside of the function and outside of the function also.
  7. Asynchronous, setTimeout and setInterval: Asynchronous JavaScript means all the javaScript code-block or processing will process serially one by one. setTimeout() will call or return the JavaScript code-block after the end of the set time. setInterval() will call or return a code-block continuously by the set time again and again and never stop.
  8. API: API stands for Application Programming Interface. Generally, I can say API is a medium of talking to one program with another. API makes a relationship with the client site to the server site. For example, I can say now I am writing on medium.com after I post it you will read it. But the question is how it is been possible? The answer is my post stored on a server by database, then by fetching the data we show the post on UI and I can edit it anytime. This whole process is done by API.
  9. DOM: DOM stands for Document Object Model. DOM is a programming interface of HTML or XML. DOM represent HTML or XML as it can be easily modified by programming language.
  10. Event Bubble: Event bubble is when a Child element reaction affects the parent element and anything done by the reaction. For example, if I click a button of section and result of the click whole section colour have been changed this is an event bubbling.

--

--