Nowadays I am seeing so many YouTube channels and their Thumbnail like ( Learn JavaScript in just 5 minutes )
Is it possible to learn any programming language in 5 minutes?12:09 PM  05 Jul 2020
I fucking LOVE JavaScript.
That’s it.
That’s the tweet.11:03 AM  05 Jul 2020
Programmer Life@programmingwala05:34 AM  07 Feb 2020
Prerequisite (✋😐)
If you're reading this article right now, please considered to read our Part 01: BigO Notation, Part 02: JavaScript Unique Part, Part 03: JavaScript Numbers, and Part 04: JavaScript Strings

Part Table of Contents Description 01 BigO Notation By the end of this chapter, you will understand how to analyze an implementation of an algorithm with respect to both time (execution time) and space (memory consumed). 02 JavaScript Unique Parts BigO is important for analyzing and comparing the efficiencies of algorithms. The analysis of BigO starts by looking at the code, and, applying the rules, applying the rules is because to simplify the BigO notation linear or quadratic rule is not enough. 03 JavaScript Numbers This part 3 will focus on JavaScript number operations, number representation, Number objects, common number algorithms, and random number generation. 04 JavaScript Strings This part 4 will focus on strings, JavaScript String object, and the String object’s builtin functions. You will learn how to access, compare, decompose, and search strings for commonly used reallife purposes. In addition, the chapter will explore string encoding, decoding, encryption, and decryption. 05 JavaScript Arrays As a JavaScript developer, you will use the array often; it is the most commonly used data structure. Arrays in JavaScript come with a lot of builtin methods. By the end of this part, you will understand arrays and choose the right method 06 JavaScript Object This part will focus on what JavaScript objects are, how they are declared, and how their properties can be changed. In addition, this part will cover how JavaScript classes are implemented using prototypal inheritance. Also this part will be short. 07 JavaScript Memory Management A variable takes up some memory. In C, the programmer allocate and deallocate memory manually. In contrast, modern JavaScript engines have garbage collectors that delete unused variables. However, there are pitfalls(unexpected) that developers can fall into(❗) This part will show these unexpected and present techniques to help the garbage collector minimize the memory problems. 08 Recursion This part 8 introduces the concept of recursion and recursive algorithms(Remember they are different, we will discuss them later(😉)). We will also discuss the definition of recursion and fundamental rules for recursive algorithms. 09 Sets This part focuses on the concepts of sets from both a mathematical definition and on the implementation. Also, Common set operations, as well as their implementations, are covered in great detail (💡). 10 Searching and Sorting This part 10 focuses on searching and sorting for arrays. By the end of this part 10, you will understand how to use sorting and searching algorithms for arrays. Also, this article is a bit complicated for beginners, so as much as possible the visual aids is your friend (👀). (😃) 11 Hash Tables A hash table is a fixedsized data structure in which the size is defined at the start. This part 11 explains how hash tables work, and the method of generating a unique key. By the end of this part 11, you will understand various hashing techniques and know how to implement a hash table. (😃) 12 Stacks and Queues This part 12 covers stacks and queues(pronounce as kyooz (🔈)) not (kwewe) okay? hehehe (😅); both are data structures used in the implementation of complex data structures. You'll learn what the stacks and queues are, how they're used, when they're used, and how to implement them (😃) Let's go! (🔥🔥🔥) 13 Linked Lists A linked list is a data structure in which each node (or element) points to another node. Unlike arrays, which have a fixed size, a linked list is a dynamic data structure. By the end of this part 13, you will understand how to implement and work with linked lists. And oh! (😮) There are two types of linked lists: singly (➡️) and doubly (↔️). Let’s examine the singly linked list first.(😃) Let's go! (🔥🔥🔥) 14 Caching Caching is the process of storing data into temporary memory so that it can be easily retrieved for later use if it is required again. As an example, a database keeps data cached to avoid rereading the hard drive, and a web browser caches web images to avoid redownloading. In this part 14, two caching techniques will discussed: LFU and LRU caching. 15 Trees A general tree data structure is composed of nodes with children nodes. The top node is called the root node. This part 15 will explore different types of trees such as binary trees, binary search trees, and selfbalancing binary search trees. First, this part 15 will cover what trees are and how they are structured. Then, it will cover methods of traversing(crossing or taking a zigzag path) the tree data structure in detail. Finally, you will learn about binary search trees and selfbalancing binary search trees to understand how to store searchable data. (😃) 16 Heaps A heap is an important data structure that returns the highest or lowest element in O(1) time. This part 16 will focus on explaining how heaps are implemented as well as how to work with them. One example is heap sort, which is a sorting algorithm based on heaps. 17 Graphs In this Part 17, you will learn graph basics, including fundamental terminology and graph types. The Part 17 will also cover working with these different graph types and methods of representing graphs in data structures. Finally, algorithms for traversing, searching, and sorting graphs are explored to solve problems such as finding the shortest path between two graph nodes. (👍) 18 Advance Strings Part 18 will cover more complex string algorithms than covered in the previous section. Now that you have heard of certain other data models or structures, they should be easier to comprehend. Specifically, Part 18 will focus on string searching algorithms. (😉) 19 Dynamic Programming Dynamic programming involves breaking down problems into their subproblems. Solving the subproblems and saving those results into memory to access them whenever a repeated problem needs to be solved, the algorithmic complexity decreases significantly (⬇️). To explain dynamic programming, let’s re examine the Fibonacci sequence that was discussed in Part 8. Then Part 19 will cover the rules of dynamic programming and walk you through some examples to make the concepts more concrete. (😉) 20 Bit Manipulation Bit manipulation is an advanced topic that JavaScript developers typically do not need to know. However, you should learn a bit about bit manipulation if you want to implement highperformance serverside code. Understanding bit manipulation requires some knowledge of digital logic. Any introductory course in discrete math or circuits would be helpful to understand these concepts.
Part 05: JavaScript Arrays(😱 🔥 📊)
As a JavaScript developer, you will use the array often; it is the most commonly used data structure. Arrays in JavaScript come with a lot of builtin methods. By the end of this part, you will understand arrays and choose the right method (💪)
Introducing Arrays (📊)
Arrays are one of the most fundamental data structures. If you have ever programmed before, you’ve most likely used an array. (😌)
var array = [1,2,3,4]
For any data structure, developers are interested in time and space complexity with the four fundamental operations: access, insertion, deletion, and search.
Insertion (🐖👈👈)
Insertion means adding a new element. JavaScript array insertion .push( element ) method adds a new element at
the end of the array:
The time complexity of this operation is $O \lparen 1 \rparen)$ in theory. Practically, this depends on the JavaScript engine that runs the code of course. (😉)
Another way to add an element is unshift() method. This
method will add at the first index in the array:
Deletion (❌❌❌)
JavaScript array deletion .pop() method removes the
last element of the array. This also returns the removed element:
The time complexity of .pop is $O \lparen 1 \rparen$
Another way to remove an element is .shift() method. This
method will remove the first element and return it:
Access (🔑🔑🔑)
Accessing an array at a specified index only takes $O \lparen 1 \rparen$ because this process get the value directly from the memory:
Iteration (🌀🌀🌀)
Iteration is the process of accessing each of the items. There are ways to iterate through an array. They all have a time
complexity of
$O \lparen n \rparen$
since the iteration is visiting
$n$
(or the number of elements).
for (Variables; Condition; Modification) (4️⃣🌀🌀)
for is the most common method of iteration. It is most often used in this form:
The previous code simply means initialize the variable i, check whether the condition is false (i<len), and then modify (i++) until the condition is false.
You can implement an infinite loop using a for loop by not setting a condition, as shown here:
for (in) (1️⃣2️⃣3️⃣4️⃣)
Another way to iterate is to call the indices(index) one by one. The variable index is the index of the array, as follows:
To print the values, use this:
for (of) (🅰️🅱️🅰️)
The variable element is the value of the array, as follows:
forEach( ) (🐾🐾🐾)
The difference between forEach and other iteration is that forEach cannot break the iteration or skip elements in the array. forEach is more expressive (😘):
Helper Functions (👬👬👬)
.slice(begin,end) (🔪✂️📰)
This helper function returns a portion of an array without modifying the array. .slice() takes two parameters: the beginning index and the ending index of the array:
If only the beginning index is passed, the ending index will assumed to be the maximum index(🔚):
If nothing is passed, this function simply returns a copy of the array:
It should be noted that array.slice() === array evaluates to false. This is because the memory address those arrays differently.
slice() is useful for copying an array. Remember that arrays in JavaScript are referencebased(connected), meaning that if you assign a new variable to an array, changes to that variable apply to the original array:
The changing element changed by accident because it is
a reference to the original array. To create a new array, you can use Array.from( new array ):
Array.from() takes $O\lparen n \rparen$ , where $n$ is the size of the array. This is automatic because copying the array requires copying all $n$ elements of the array.
.splice(begin,size,element1,element2…) (1️⃣📐📄)
This helper function changes the contents of an array by removing and/or adding new elements. .splice() takes three parameters: the beginning index, size to be removed, and the new elements to add.
New elements are added at the position specified by the first parameter. It also returns the removed elements:
Object type can be also added to the array:
.splice() is $O \lparen n \rparen$
Similarly to copying, if the range of .splice( ...range ) method specified is the whole array, then each $n$ item from that array has to be removed.
Concat (✂️➕📃)
Concat() adds new elements to the array at the end of the array and returns the results array:
Note(📝): Concat() don't change the original array, but instead copy the original array to a new array
.length Property (📏📏📏)
The .length property returns the size of the array:
But changing this property to a lower size can delete elements from the array:
Spread Operator (🎉🎉🎉)
The spread operator (...) is used to expand arguments(or values):
Both the Math.max and Math.min functions can use the spread operator. To find the maximum in an array, use this:
To find the minimum in an array, use this:
JavaScript Functional Array Methods (🐾🐾🐾)
JavaScript can be written like a functional programming language. It does not use loops (😐), only function (method) calls (😊).
In this section, only three functional array methods in JavaScript will be explored (😭): map, filter, and reduce.
Note(📝): These methods do not change the original array contents
Map (📜📌🚩)
The map function transform every element in the array
and returns a new array. For example, you can multiply every element by 10, as shown here:
Filter (🚯📵🚳)
The filter function returns only elements that meet condition. For example, this filters elements greater than 100:
Note(📝):Again, this does not change the original array. (😑)
Reduce (📉📉📉)
The reduce function combines all the elements into one value. For example, this adds all the elements:
This function also can take its second argument (😱). For example, providing 1 will yield to 11, as shown here:
Multidimensional Arrays (🌒🌘🌑)
A multidimensional array is an array with a degree or dimension greater than one. For example, a 2D array, or twodimensional array, is an array of arrays, meaning rows and column matrix
JavaScript doesn't natively provide the multidimensional array like the one below:

Figure 51. Multidimensional array
See Figure 51, unlike Java and C++, JavaScript does not have multidimensional arrays. (😿)

Figure 52. Jagged array
Instead, there are jagged arrays ! (😹) at the Figure 52. A jagged array is an array whose elements are arrays.

Figure 53. Threebythree matrix
Here is a function to create a jagged array like the one in Figure 53:
By defining an array of elements, you can create a multidimensional array, where each element is another array too. For this reason we can say a multidimensional array of JavaScript is an array of arrays.

Figure 54. Threebythree matrix of numbers
To access elements in a jagged array, specify a row and a column (see Figure 54):
Summary (📚)
Various array functions were covered in this part and are
summarized in Table 51

Function Usage push(element) Adds an element to the end of the array pop() Removes the last element of the array shift() Removes the first element of the array slice(beginIndex, endIndex) Returns a part of the array from beginIndex to endIndex splice(beginIndex, endIndex) Returns a part of the array from beginIndex to endIndex and modifies the original array by removing those elements concat(arr) Adds new elements (from arr) into the array at the end of array Table 51. Array Function Summary
An iteration of array elements can use the loop mechanisms shown in Table 52:

Function Usage for (var prop in arr) Iterates by the index of the array element for (var elem of arr) Iterates by the value of the array element Table 52. Iteration Summary
Finally, recall that JavaScript utilizes jagged arrays, an array of arrays, to get multidimensional array. (😊)
Challenge (😤🔥👊)
Have some time to solve this riddle while waiting for part 6. However, there is sample code and explanation, solve this on your own, and have your own code other than the code and explanation provided below, I don't want to see your answer or explanation (or if you want to show it all right, just make sure to share it in the comment: (😅)
FIND TWO ARRAY ELEMENTS IN AN ARRAY THAT ADD UP TO A NUMBER
Problem: Given the array arr, find and return two indices of the array that add up to weight or return 1 if there is no combination that adds up to weight
Explanation: For example, in an array like [1,2,3,4,5], what numbers add up to 9?
FIND THE MEDIAN OF TWO SORTED ARRAYS OF THE SAME SIZE
Problem: Recall that median in an even number of a set is the average of the two middle numbers. If the array is sorted, this is simple.
Explanation: [1,2,3,4] has the median of (2+3)/2 = 2.5
FIND COMMON ELEMENTS IN KSORTED ARRAYS

Figure 54. Three Variables
Problem: In this example with three arrays, k=3.
Exaplanation: To do this, simply iterate over each array and count instances of every element. However, do not track repeated ones (5 and 5.5 should be counted once in one array iteration). To do this, check whether the last element is the same before incrementing. This will work only if it is sorted.
SPIRAL PRINT

Figure 55. Spiral Print
Problem: Let’s create an example problem with a matrix. Given a matrix, print the elements in a spiral
order, like in Figure 55.
Explanation: This looks like a daunting task at first. However, the problem can be broken down to five main
components. Printing from left to right, printing from top to bottom, printing from right to left, printing from bottom to top, keeping a limit on these four operations
Discussion