
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

1K+ Views
innerHTML − The innerHTML property returns the text, including all spacing and inner element tags. It preserves the formatting of the text and all the extra tags like , etc.innerText − The innerText property returns just the text, removing the spacing and the inner element tags.Following is the code for innerHTML and innerText in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result, .sample { font-size: 18px; font-weight: 500; color: red; ... Read More

1K+ Views
Undeclared − It occurs when a variable which hasn’t been declared using var, let or const is being tried to access.Undefined − It occurs when a variable has been declared using var, let or const but isn’t given a value.Following is the code for undeclared and undefined in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 18px; font-weight: 500; color: blueviolet; } Undeclared vs Undefined ... Read More

977 Views
Following is the code for validating a file size in JavaScript while uploading −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 18px; font-weight: 500; color: blueviolet; } Validating a file size while uploading Upload a file using the above file input type let BtnEle = document.querySelector(".Btn"); let resEle = document.querySelector(".result"); let fileEle = document.querySelector(".file"); function validateFile() { if ... Read More

681 Views
In JavaScript, functions can be assigned to any variables, they can be passed as arguments to other functions, and can even be returned from other functions. This behavior of functions allow us create HOCs in javascript, which are functions that return other functions. These higher−order functions can be used in various applications like callback functions, function memoization, or transformation, etc. In this article, we will learn functions returning another function, aka higher−order functions in javascript, and how we use them to implement certain javascript features like callbacks, array/object filtering and transformations, etc. Let’s look at some of the examples to ... Read More

5K+ Views
Loops are used in JavaScript to repeat actions or iterate over a piece of data. With the aid of various techniques, we can add a delay between each iteration of the loop in order to regulate the speed of execution or produce particular temporal effects. This article will teach you how to include a delay in a java script loop and how to use it to delay the execution of a specific piece of code that is running inside one. Let’s look at some of the examples to understand the concept better − Example 1 - Using setTimeout() In the ... Read More

527 Views
We will learn how to check or uncheck checkboxes in javascript in this article, and how we can use it to allow users to make multiple selections on the web page Checboxes are one of the most used HTML elements in forms and user interfaces that allow users to pick numerous options. In JavaScript, we can dynamically check or uncheck checkboxes based on certain conditions or user interactions. Let’s look at some of the examples to understand the concept better − Example 1 In this example, we will − We will create 3 different checkboxes, a checkAll() and ... Read More

373 Views
JavaScript treats functions as objects and allow us to pass functions as parameter to another function and even return functions from other functions. In JavaScript, the functions are first class functions i.e. we can store them in variable, objects and array. The higher order arrow functions can take function, return them or do both.Following is the code for higher order arrow functions in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result, .sample { font-size: 18px; ... Read More

1K+ Views
Internet Protocol address, in short, IP address, is a unique address represented by a string of numbers that identifies a device on the internet or a local network. In JavaScript, we can retrieve a client's IP addresses using a 3rd parties API services such as ipify or ipapi. We can then further use this information to track user locations, personalize content based on the location, or implement security measures. Using "ipify" API To obtain the client's IP address, we will use a third−party API service (https://www.ipify.org/). We'll send a GET call to the "ipify" API using the $.getJSON() function to ... Read More

321 Views
Following is the code for disabling arrow key in text area in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-weight: 500; font-size: 18px; color: blueviolet; } Disabling arrow keys in a text area Hello world this is some sample text inside the text area element Disable arrows Click on the above button to disable scrolling using arrows in the above textArea let ... Read More

2K+ Views
Following is the code for setting full screen iframe in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-weight: 500; font-size: 18px; color: blueviolet; } .fullScreen { width: 100vw; height: 100vh; } Setting full screen iframe Fullscreen Click on the above button to make the iframe go fullscreen let BtnEle = document.querySelector(".Btn"); let frameEle = document.querySelector(".frame"); BtnEle.addEventListener("click", () => { frameEle.className = "fullScreen"; }); OutputOn clicking the ‘Fullscreen’ button −