
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10483 Articles for Web Development

679 Views
In this article, you will understand how to remove false values from an array in JavaScript. An array in JavaScript is a special variable that can hold more than one item. An array can be initialized using the keyword ‘const’ .Falsy values are nothing but boolean false values. Example 1 The first way of achieving it is by iterating the array using a for-each loop and pushing the non-false values to another array and returning the array. const inputArray = [true, false, false, true, null, 505, 101]; console.log("The input array is defined as: ") console.log(inputArray) function removeFalsey(inputArray) { ... Read More

783 Views
We can use the "Object.keys()" method to retrieve the keys of an object. However, instead of returning the keys as a string, we can wrap the call to "Object.keys()" in a function. This way, when we call the function, it will return the keys as a method, rather than a string. Approach 1 You can use the Object.keys() method to get an array of the keys of an object, then use array notation or the [] operator to access the key as a property of the object. Here is an example − let obj = { key1: "value1", key2: ... Read More

10K+ Views
We will use the eval() function to call a function from its name stored in a string. The eval() function evaluates a string as JavaScript code. This allows us to call the function by passing the string containing its name as an argument to the eval() function. Example Here is a complete working example of how to call a function from its name stored in a string using JavaScript − // Define the function that we want to call function sayHello() { console.log("Hello, world!"); } // Store the function name as a string let functionName ... Read More

38K+ Views
We will call a function by referencing its name and adding parentheses after it. If the function we are calling returns another function (it does in our case), we will need to assign it to a variable or call it immediately. In the future, we will need to make sure that we understand the behavior of the returned function and how it can be utilized in our code. This is call Function Currying. Function Currying Function currying is a technique in functional programming where a function is transformed into a sequence of functions, each taking a single ... Read More

30K+ Views
We will use the setInterval() function to repeatedly call a function every 5 seconds. This function takes two arguments, the first being the function to call and the second being the interval time in milliseconds. JavaScript setInterval setInterval() is a JavaScript function that allows you to execute a function repeatedly at a specified interval (in milliseconds). It returns a unique ID that can be used to clear the interval with the clearInterval() method. It can be useful for tasks such as periodically updating a page or creating animations. It takes two arguments, the function to be executed, and the ... Read More

3K+ Views
We will use a for loop to iterate through the array. We will initialize a variable called "result" with the value of the first element in the array. For each subsequent element in the array, we will use the XOR operator to update the value of "result" with that element. This process will continue until all elements in the array have been processed, resulting in the final XOR value of all elements in the array. Let us first understand what XOR is. We will also see how XOR operation on an array works. Array XOR The XOR (exclusive ... Read More

2K+ Views
To calculate the date three months prior using JavaScript, we will first need to create a new date object, which will represent the current date. We will then use the setMonth() method to subtract 3 from the current month. Finally, we will convert this new date object back to a string using the toString method to display the date three months prior. Basically, we will be writing a dynamic JavaScript function that can take in a number as its input and return the date prior to that number of months from today’s date. For example − calculatePriorDate(4); This ... Read More

1K+ Views
We will first determine the bonus percentage by multiplying the basic salary by a certain percentage. Next, we will calculate the bonus amount by multiplying the bonus percentage with the basic salary. Finally, we will add the bonus amount to the basic salary to determine the gross salary and print all three values. Here is an example of how to calculate and print the bonus and gross salary using the basic salary in JavaScript − // Declare basic salary variable var basicSalary = 5000; // Calculate bonus (10% of basic salary) var bonus = basicSalary * 0.1; // ... Read More

2K+ Views
We will start by creating a basic HTML structure for our website. Next, we will use jQuery to create a terminal-like interface by adding elements such as input fields and output displays. Finally, we will use jQuery functions to handle user input and display the appropriate response. Let us first understand what jQuery is. jQuery is a JavaScript library that simplifies HTML document traversing, event handling, and animation. It allows for easy manipulation of the Document Object Model (DOM). It also provides several shorthand methods for common JavaScript tasks, such as making AJAX requests. It is widely used in web ... Read More

5K+ Views
We will start by creating a canvas element in our HTML document using the canvas tag. Next, we will use JavaScript to draw a circle on the canvas and set its initial position and velocity. Finally, we can use JavaScript to continuously update the position of the circle based on its velocity and add collision detection to change the velocity when it hits the edges of the canvas. Approach To build a bounce ball using HTML and JavaScript, you will need to do the following − Create an HTML file with a canvas element on which the ball will ... Read More