A computer pattern or idea called recursion is present in many programming languages, including JavaScript. It is a feature used to build a function that repeatedly calls itself, but with a smaller input each time, until the intended outcome of the code is realized. In this article, we will return the correct value from a recursive indexof() function in JavaScript. Let’s dive into the article for a better understanding. Accurate value from the recursive indexof() function The position of the first occurrence of a value in a string is returned by the indexOf() method. -1 is returned by the indexOf() ... Read More
The task we are going to perform in this article is setting a default variable value to undefined in a function. Before we jump into the article, let’s understand what are functions in JavaScript. One of the core components of JavaScript are functions. In JavaScript, a function is comparable to a procedure-a collection of statements that carry out an action or compute a value. However, in order for a process to be considered a function, it must accept an input and produce an output with an evident connection between the input and the result. Let’s see how to set a ... Read More
Each value in an array is referred to as an element, and each element has a certain numerical location in the array, which is referred to as its index. Nested Arrays, a feature of JavaScript, allow us to create arrays inside arrays. One or more arrays can be used as the elements of nested arrays. Although the term may be a little unclear, as we look further, it is actually rather fascinating. Accessing and returning nested array In JavaScript, a nested array is described as an Array (Outer array) inside another array (inner array). One or more inner Arrays are ... Read More
The SASS is a CSS preprocessor that keeps the CSS code dry as it doesn’t allow repetition in the code. There are various directives available in the SASS, one of which is the @import directive. The ‘@import’ directive is used to import the code of one ‘.scss’ or ‘.sass’ file into another file and execute it during compilation. We can import the variables, functions, mixins, etc., from one file to another using the ‘@import’ directive. Syntax Users can follow the syntax below to use the ‘@import’ directive in the SASS to import the file. @import 'test' We have imported ... Read More
CSS stands for the Cascading style sheet. HTML is used to create a web page, which adds text, images, videos, etc., to the web page. After that, we require to style the texts and images, which we can do using CSS only. Basically, we can add styles such as background, color, dimensions, direction, etc., to the HTML element using CSS. There are three ways to add style to the web page. First is the inline style, which directly adds style to the HTML element. The second is an embedded style sheet that adds styles in the ‘html’ file inside ... Read More
In JavaScript, arrays are used to hold several values in a single variable. Compare that to a variable that only has room for one value. Each item in an array has a number associated with it that you may access by using, referred to as a numeric index. The task we will perform in this article is “How to iterate a JSON array in JavaScript”. Let's get started with the article to get a better understanding of iterating a JSON array. Iterating JSON array Ordered lists of values are represented by JSON arrays. Multiple values can be stored in a ... Read More
We can add transitions to HTML elements using CSS. Before we start with the tutorial, let’s understand what transition is. Basically, the transition is an element changing from one state to another state. For example, we change the dimensions of the element when users hover over the element. In CSS, we can add transitions to elements using two ways. First is to use ‘transition-property’, ‘transition-duration’, ‘transition-timing-function’, and ‘transition-delay’ all 4 properties together. The second is using only the ‘transition’ CSS property. The CSS ‘transition’ property is shorthand for the below CSS properties. Transition-property − It specifies the CSS property ... Read More
The HTML tables are created using the tag in which the tag is used to create table rows and tag is used to create data cells. The elements under are regular and left aligned by default. The HTML tables allow web authors to arrange data like text, images, links, other tables, etc. into rows and columns of cells. Let’s dive into the article to learn more about applying an if condition to every element in an HTML table. Applying if condition to every element in an HTML table If a certain condition is true, the if/else ... Read More
HTML is used to create web pages. In every new release of HTML, developers make some changes and add unique features. Here, we will discuss that unknown features by most developers who can help developers improve web pages. Here, we have explained the top 5 HTML tricks with examples. Color Picker in HTML We can create a color picker in HTML using the tag. It allows us to pick up any colour by clicking on the colour or adding RGB values. Syntax Users can follow the syntax below to create a color picker using HTML. In the ... Read More
Sometimes, we need to highlight the HTML element when we click it and make it normal when we click outside the HTML element. We can achieve it by toggling the class in the element. Here, the meaning of the toggling class is adding and removing the class. In this tutorial, we will learn to add the class name to the element when users click the element and remove the class name from the element when users click outside the element. Using the Add() and Remove() Method to Toggle Class When Clicking Inside and Outside of the Element In JavaScript, add() ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP