Photo by Clément Hélardot on Unsplash

Functions as a concept are extremely important to know in any programming language. They’re quite helpful when it comes to reusability and structuring the code to make it more readable.

In my previous articles, we have already seen different ways of using functions i.e. regular functions and function expressions.

But there is another type of function too, Immediately Invoked Function Expression or IIFE( pronounced iffy ). IIFE is a function expression that runs immediately after its definition. We do not have to explicitly call the function.

Syntax

Variation 1:

Variation 2:


Photo by Arnold Francisca on Unsplash

Hoisting in JavaScript is a concept that moves all variable declarations and function declarations to the top of the script in the current scope before execution.

In simple words, hoisting allows one to use variables and call functions before they’re even declared. This concept is absolutely essential to understand for a beginner. If not understood, this can cause unwanted bugs in your code!

Note: Only declarations are hoisted and not initializations.

In this article, I will be writing about how hoisting works for functions. …


Photo by Prateek Katyal on Unsplash

The ‘this’ keyword in JavaScript refers to the object that is executing the current function. The ‘this’ keyword works differently in different contexts and can be confusing to understand, especially for newcomers, for whom it can prove to be quite daunting. In this article, I have explained the behavior of ‘this’ in different contexts.

Global Context

In the global context, i.e. outside any function or object, ‘this’ keyword refers to the window object.

For example:

Output:


Photo by Maxwell Nelson on Unsplash

What are Template Literals?

JavaScript already has a way of defining strings, using single quotes (‘ ’) or double quotes (“ ”). So why the need for template literals?

Well, template literals allow us to dynamically manipulate strings with more ease. Unlike regular strings, template strings are defined with the backtick (``). Apart from the syntax difference, it has special features that distinguish it from the regular strings such as the multiline string and the string interpolation feature. It helps us write string literals in a way that has a clean code structure, is readable, and easy to maintain.

Regular string:


Photo by Greg Rakozy on Unsplash

Note: This article is only for beginners in JavaScript and who are confused as to why there are three keywords for doing the same job(declaring variables) and which one to use when and where.

With the emergence of ES6 (ES 2015), a few shortcomings of JavaScript had been addressed with the implementation of a number of new features, one of them being the let and const keyword. The previous version of JavaScript had only one method of declaring a variable, i.e. using the ‘var’ keyword. ES6 then introduced the ‘let’ and ‘const’ keywords, which are also used for declaring and…


Photo by Clément Hélardot on Unsplash

JavaScript is a multifaceted language. It can be client side, server side, object oriented and most importantly it is synchronous.

Synchronous languages as the name suggests, executes the code line by line, each waiting for the previous line to finish with execution. Synchronous execution is great when there is data to be processed that depends on or is depended upon on some other data. However not all situations are the same. In case of independent data processing, the code would remain stuck executing that one line and waste useful resources.

For example, consider this scenario :

When a user needs…


Photo by Paul Zoetemeijer on Unsplash

What are f-Strings?

f-Strings are a new way to format strings in Python 3.6 and above. If you are new to Python, f-String is basically a great addition to Python’s string formatting world and by the end of the article you will know why. But if you are someone who has been using Python for long, you must have definitely used one of the two old school methods of string formatting namely, the “%” operator or the second way, format() method. …


What are Virtual Environments, why they are useful, and how to set one up on your computer

What are Virtual Environments?

We all are aware of the term Environment and its meaning: It is nothing but a surrounding in which we operate. Python too has its own concept of virtual environments. To begin with, let’s consider the example of a refrigerator, it is used to store food at cool temperatures. However certain food items such as meat require to be stored at cooler temperatures. Therefore the refrigerators has its own isolated “Environment” also known as a deep freezer where the meat can be stored. Hence, although the refrigerator does the task of cooling, there are some items which have different requirements…

Adhyantini Bogawat

I am a recent graduate and work as a software engineer at Persistent Systems. I believe in sharing with the community whatever I learn and I love to write!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store