
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 6710 Articles for Javascript

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

11K+ Views
We can break JavaScript code into several lines by using the backslash () at the end of the line. This tells the JavaScript interpreter to continue reading the next line as part of the same statement. Additionally, we can also use parentheses, brackets, or curly braces to create multiple lines of code within a single statement. This helps to make the code more readable and easier to maintain. Let us first understand what code splitting is. Code Splitting Code splitting is a technique used in web development to load only the necessary code for a specific page or component, rather ... Read More

318 Views
A web developer is a programmer who specializes in the development of applications and services for the World Wide Web. They are responsible for designing, coding, and building websites and web applications using a variety of programming languages and frameworks. Web developers may also be involved in the maintenance and updates of existing websites and web applications. They typically work alongside web designers to create visually appealing and user-friendly websites. Web development can be divided into front-end development, which focuses on the user-facing side of websites, and back-end development, which focuses on the server-side functionality of websites. To become a ... Read More

14K+ Views
We can use the preventDefault() method to prevent the default behavior of the click event on the dropdown menu. By doing this, the menu items will not close when clicked inside. Additionally, we can add a click event listener to the dropdown menu and set the event.stopPropagation() method to stop the event from propagating to parent elements. HTML Dropdown HTML dropdown is a type of form element that allows users to select one option from a list of options. It is created using the "select" and "option" tags in HTML. The "select" tag defines the dropdown container and the "option" ... Read More

1K+ Views
We would first need to access the post's comment section through the Facebook API. Then, we would use a loop to iterate through each comment and use the API to like each one. Finally, we would need to implement error handling in case any issues arise during the process. Approach If you want to use JavaScript to automatically like all comments on a Facebook post, here are some requirements you must meet − You would need to use the Facebook Graph API to first get all comments on a post. For each comment, you would need to call the ... Read More

354 Views
We can append new information to errors by creating a new error object with the original error as its prototype and adding additional properties. This allows us to maintain the original error message while also providing additional context. JavaScript Functions In JavaScript, a function is a block of code that is executed when it is invoked. Functions are declared with the function keyword. Functions can take arguments. The arguments are the values that are passed to the function when it is invoked. Functions can return values. The value that is returned by the function is the value that is assigned ... Read More

19K+ Views
To append HTML code to a div using JavaScript, we will be using HTML DOM methods and property. We have discussed four different approaches in this article with stepwise explaination and complete example codes. In this article, we are having a div with id container and our task is to append HTML code to a div using JavaScript. Approaches to Append HTML Code to a div Here is a list of approaches to append HTML code to a div using JavaScript which we will be discussing in this article with stepwise explaination and complete example codes. ... Read More

30K+ Views
Sometimes, we require to uncheck a radio button using JavaScript or JQuery. For example, we use the radio button in the form. When the user presses the clear form button, we need to uncheck all radio buttons and allow again users to choose any option from the radio button. In this tutorial, we will learn various methods to uncheck single or multiple radio buttons using JQuery or JavaScript. Use the JavaScript to uncheck the radio button We can access the radio button in JavaScript using id, tag, name or other ways. After that, we can uncheck the radio ... Read More

3K+ Views
While working with the data, removing the unnecessary white spaces from the string is necessary. So, we need to trim a string at the beginning or end. If we keep unnecessary white spaces in the data, it can cause some issues. For example, while storing the password, if we don’t trim the white space, it can mismatch when users try to log in another time to the app. In this tutorial, we will learn to trim a string at beginning or ending in JavaScript. Use the trimRight() method to trim the end of the string The trimRight() method ... Read More

3K+ Views
We have given a string and need to convert it into a function in JavaScript. Sometimes, we get mathematical or function expressions in the form of the string, and executing that expression, requires converting strings into the function expression. In this tutorial, we will learn different approaches to converting the given string into a functional or mathematical expression. Use the eval() method The eval() method takes the expression as a parameter and evaluates the expression. For example, if we pass the ‘2 + 2’ string as a parameter of the eval() method, it returns 4 as it evaluates the ... Read More