Author: Saim Khalid
-
Get the Current URL
In JavaScript, we can get the current URL of the page using the window.location object. The window.location object contains information about the current URL of the page. We can get URL from another method also, which is document.URL. Another method is document.documentURI which returns the location of the document as a string. Using window.location The window.location object can be used to get the current…
-
Null Checking
In this chapter, we will learn how to check the null values in JavaScript. The null value indicates the intentional absence of any object value. It is a JavaScript primitive value that is false when used in Boolean operations. This distinguishes null from the related primitive value undefined, which is an unintended absence of any…
-
Nested Loop
In JavaScript, a loop inside another loop is called a nested loop. We need nested loop when we iterate over multi-dimension array or matrix. When we have to perform repeated actions on each element of an array we do use nested array. Nested loops in JavaScript Let’s say we have two arrays, one is an…
-
Linked List
Linked List is an ordered collection of data elements. In linked list the data will be represented in Nodes. Node has two parts, the first part will be holding the data of the element and second part of the node (pointer) will store the address of the very next node. In linked list elements are…
-
Lazy Loading
In JavaScript, there is way to make website faster. Means, we can only load what we need first like images, videos,etc. The file or data which is not needed at the moment that can be loaded later when it needed this is called lazy loading. For example, When you open the Instagram app, It only…
-
Insertion Sort Algorithm
The Insertion Sort is a sorting algorithm that works very similar to the way we sort the playing cards when we play. The arrangement of elements in a sorted manner is done through insertion sort. In this algorithm, the array will be divided virtually into two parts which are sorted and unsorted parts. The values…
-
HTTP Requests
Http is a protocol, stands for hypertext transfer protocol. The http requests are used to communicate with web servers. It allow us to send requests to a server and get responses. These can be used to fetch data, submit forms, upload file and more. HTTP Methods These are the most commonly used HTTP methods: Ways…
-
Generate Colors
Generating colors are quite handy while working on web development projects. For beautiful UI, we need to use different colors. In this chapter, we will learn how to generate colors in JavaScript. Generating Random Hex Color The Hex (Hexadecimal) code is a six-digit code and a three-byte hexadecimal number that is used to represent the…
-
Filter Method
JavaScript – Filter Method In JavaScript, the filter() method is used to create a new array with elements that pass a certain condition. It takes a callback function as its argument which is executed for each and every element in the array. If the callback function returns true, the element is added to the new array or…
-
Date Validation
In JavaScript, we can validate the date. A date should be in a particular format or it should be in a particular range and should be valid. Why we validate a date ? Lets understand why we need to validate the date in JavaScript by example. Suppose, you have developed an application that takes some…