
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

579 Views
Checking whether a number is NaN (Not a Number) or finite is important while working with numerical computations in JavaScript. NaN (Not a Number) indicates a value that can't be represented as a number, often occurring from invalid operations like dividing zero by zero (0/0). Finite numbers are all real numbers in JavaScript that are neither Infinity, -Infinity, nor NaN. JavaScript provides several built-in methods to determine if a value is NaN (Not a Number) or if a number is finite. In this article, you will understand how to check if a number is NaN or finite using these built-in ... Read More

1K+ Views
For a given integer number, write a program in JavaScript to check whether a number is odd or even and return the same to the user. It’s pretty easy to check whether a number is even by using the modulo operator. But, in this article, we will be checking whether a number is even or not without using the modulo operator. Using the for loop In this approach, we are going to use the for loop to check whether a number is even or not. The idea is to take a Boolean flag variable as true and check it up ... Read More

2K+ Views
JavaScriptis a single-threaded synchronous function that performs operations. It is a timeconsuming operation that blocks other operations of the thread.We can use the asynchronous programming provided by JavaScript that performs functions without blocking other operations of the thread. This can be done by asynchronous code like promises or async functions (which basically are cleaner promises).Asynchronous functions are cool but the time of their execution is not certain which might create a problem. Also, it is not easier to track async functions for any potential errors.In this article, we will be exploring the chaining of asynchronous functions using ES2015+ features like ... Read More

2K+ Views
In this article, we are going to explore constructors in an object. We can create inheritance in terms of object, i.e. a parent object can have one or multiple child objects. Now we can call the constructors of a parent object from the child object.ConstructorThese are the instances of a class that is commonly referred to as an Object. The new keyword from JavaScript uses a constructor to be called when an object needs to be declared or created. We can set properties into an object using these constructors.Inheritance in JavaScriptThis is the ability of an object to access the ... Read More

2K+ Views
In this article, we will be exploring the calling and initialization of the JavaScript function from an HTML template. We require the JavaScript function to execute the desired methods over the input passed.In this tutorial, we will be discussing two major approaches to calling a JavaScript function from an HTML page.In the first Approach, we are going to take a simple input tag and a Submit button associated with it. Once the button is clicked we will see a dialog box that pops up on the screen as an alert. This button on click calls invokes the JavaScript function to ... Read More

4K+ Views
In this article, we will be exploring how to add HTML elements dynamically so that they could change the view component. Also not just an HTML element, we can also add CSS properties to HTML elements with the help of JavaScript. In this article, we will be using a button to facilitate the addition of an HTML element in the already built template.ApproachWe will create a Simple HTML page with some components defined.Once the page is created we will be writing some outer HTML and adding a button to it so that we could add this HTML when a user ... Read More

934 Views
In this article, we will be exploring Google Maps and how to add or embed google maps into our HTML template/website. Once the Google Maps are embedded into the website we can pin a location in it to display the user the current position of the store or a company.StepsBelow are the steps that need to be followed to embed Google Maps into your HTML pages −We need to generate an API key to be able to use Google maps privately.Creating the HTML container to place Google Maps.Adding the external script provided by Google inside the HTML document.Write the JavaScript ... Read More

561 Views
JavaScript is a relatively new language with lots of new features and enhancements over the traditional HTML & CSS pipelines. With the new age era, JavaScript has captured most of the frontend market in a relatively lower period of time. It has gained tremendous popularity and is the go to language for any frontend needs.In this article, we are going to explore how does the traditional JavaScript works behind the frontend templates. How it processes the elements and how it executes them?JavaScript is a synchronous, single threaded language with specific order of execution.Everything inside a JavaScript function executes inside the ... Read More

350 Views
In this article, we will be exploring how async code actually works in JavaScript, how it is initialized, and how it is executed and called. But before moving on let’s look at what is synchronous code and how it is different from asynchronous codeSynchronous Code − This implies that the user is having the data that is synchronously called and accessed as available in the order. In this user calls the method and only after the method is called it is executed and checked.In Asynchronous code, the trigger is hit by a user or system. It is not necessary who ... Read More

19K+ Views
In HTML, sometimes the user needs to access the HTML elements to display the user different changes. We can support this by using modern-day JavaScript. To facilitate this, we can move ahead and change the HTML element by using the following techniques −Get HTML element by IdGet HTML element by classNameGet HTML element by NameGet HTML element by tagNameGet HTML element by CSS SelectorBelow we have added the demonstration for the above methods.Get HTML element by IdThis method gets the element from a unique ID and lets the user access that element. Users can use the getElementById() method to access ... Read More