javascript

javascript

JavaScript program to open one url in a new tab

The anchor tag is used in HTML to open one new link in a new page. You can use this tag if you have a static URL. But, sometimes, we may need to do it dynamically as if the user clicks on a button, we will open one link in a new tab. We need JavaScript for that. JavaScript provides one method called window.open() that can be used to open a link in a new browser tab.

Read
javascript

How to change HTML page using JavaScript

You can add one piece of JavaScript code with a HTML page to change or modify HTML and CSS values dynamically. HTML is a markup language that is used to define the structure of a page, CSS is style rules used to add styles to a HTML page and JavaScript is a scripting programming language that is used to add complex dynamic features to a HTML page like responding to different user interactions, changing the web page dynamically, animate the page, etc. Without JavaScript, your web page will be a static page.

Read
javascript

JavaScript setTimeout() method example

setTimeout() method is used to execute a piece of code after a certain delay. In this post, I will show you how to use setTimeOut with examples.

Read
javascript

Difference between null and undefined in JavaScript

We often got confused with null and undefined in javascript. In this blog post, I will explain to you in simple words with an example. The difference is same for both Javascript and Typescript.

Read
javascript

Date constructors in JavaScript

new Date() creates one new Date object. It uses the current time at the time of initialization. For example :.

Read
javascript

JavaScript Math expm1() function

expm1() is defined in Math. It is a static method and you can call it directly like Math.expm1(). It takes one number as the argument and returns e^n - 1, where n is the provided number. That means, its value is equal to Math.exp(n) - 1.

Read
javascript

JavaScript program to find all years in a range with first January Monday

In this JavaScript program, we will learn how to find all years in a range with first January as Monday. With this program, you will learn how to use a loop in JavaScript and how to check the current day using Date constructor.

Read
javascript

JavaScript program to find the nearest number in an array

Our problem is to find the nearest number in an array specific to a given number. For example, if our array is [1,5,10,15,20] and if the given number is 18, the output of the program should be 20 as this is the nearest number to 18 in this array. Again, if the number is 16, it will print 15. Note that we are checking in both ways to find the nearest number.

Read
javascript

JavaScript program to find the largest of five numbers

In this tutorial, I will show you four different ways to find out the largest of five numbers using JavaScript. You can use these approaches to find out the largest of any n numbers. Let's move to the examples :.

Read
javascript

How to remove only the fractional part of a number in JavaScript

JavaScript provides one inbuilt method to remove the fractional part of a number. If you have one floating-point number like 1.24 and you need only the integer part i.e. 1, you can use this method. In this tutorial, I will show you how to do that in JavaScript with a simple function. In the example, I will show you how to do that with different inputs.

Read