Add 10 Seconds to a JavaScript Date Object

Saurabh Jaiswal
Updated on 22-Aug-2022 08:08:54

4K+ Views

In this tutorial, we will learn how to add 10 seconds to a JavaScript Date object. Here we will discuss two methods which are following. Using the setSeconds( ) Method Using the getTime() Method Using the setSeconds() Method JavaScript date setSeconds() method sets the seconds for a specified date according to local time. This method takes two arguments, the first is the number of seconds between 0 to 59 and the second is the number of milliseconds between 0 to 999. If you do not specify the second parameter, the value returned from the getMilliseconds() method is used. ... Read More

Add Hours and Minutes to a Date in JavaScript

Saurabh Jaiswal
Updated on 22-Aug-2022 08:06:32

12K+ Views

In this tutorial, we will learn how to add hours and minutes to a date with JavaScript. We have multiple methods to achieve this which are the following. Add hours using the setHours() Method. Add minutes using the setMinutes() Method. Add hours or minutes with the getTime() Method. Add hours using the setHours Method JavaScript date setHours() method sets the hours for a specified date according to local time. Syntax Following is the syntax to apply the setHours() method to add hours to date − Date.setHours(hours, minutes, seconds, ms) Note − Parameters except the first one are ... Read More

Add Event Handler to an Element in JavaScript HTML DOM

Saurabh Jaiswal
Updated on 22-Aug-2022 08:00:39

2K+ Views

This tutorial will teach how to add an event handler to an element in JavaScript. There are two ways to add an event handler to any element, the first is using the addEventListener method and another is using the event attributes. Using the addEventListener() Method The addEventListener() method is used to attach an event handler to any DOM element. The syntax of this method is following. Syntax element.addEventListener( event, function, capture ) Parameter Event − The name of the event you want to apply on the element e.g. click, mouseover, submit, etc. Function − The callback function which ... Read More

Add Element to the End of a JavaScript Array

Saurabh Jaiswal
Updated on 22-Aug-2022 07:51:19

6K+ Views

In this tutorial, we will learn how to add an element to the last of a JavaScript array. The most common method to add an element to the last of the array is by using the Array push() method but we will discuss multiple methods by which we can achieve this. Here are some approaches to achieve this. Using the Array.prototype.push( ) Method Using the Array.prototype.splice( ) Method Using the Array Indexing Using the Array.prototype.push() Method To add an element in the last, use the JavaScript push() method. JavaScript array push() method appends the given element(s) in the ... Read More

Difference Between Dynamometer and Induction Type Wattmeter

Manish Kumar Saini
Updated on 19-Aug-2022 13:36:05

7K+ Views

A wattmeter is an electrical measuring instrument that measures active (or real) power in an electric circuit. It measures the value of electric power in watts, kW, MW, etc. Based on the principle and construction, the wattmeters are classified into two major types as − Dynamometer type wattmeter Induction type wattmeter The primary function of both dynamometer and induction type wattmeter is the same, i.e. measurement of active power in the circuit. However, these two types of wattmeters are different from each other in many aspects. In this article, you will learn all the differences between dynamometer ... Read More

Difference Between Ceramic Capacitor and Electrolytic Capacitor

Manish Kumar Saini
Updated on 19-Aug-2022 13:09:43

11K+ Views

A capacitor is a circuit component which has ability to store electrical energy in the form of electrostatic field. A capacitor consists of an assembly of two parallel plates that are separated by an insulating material called dielectric. When a voltage is applied to the capacitor, the dielectric material between its plates get polarized, i.e. its charges or ions get separated. The negative ions accumulated near the positive plate and positive ions accumulated near the negative plate. In this way an electric field is established inside capacitor. Hence the capacitor is said to be charged. There are several capacitors available. ... Read More

Difference Between MAC Address and IP Address

Mahesh Parahar
Updated on 19-Aug-2022 12:38:43

10K+ Views

Both MAC Address and IP Address are used to uniquely identify a machine on the internet. MAC address is provided by the chip maker while IP Address is provided by the Internet Service Provider. Mac Address Media Access Control (MAC) address is a physical address that works at the data link layer of the OSI model. A MAC address is a 48 or 64-bit address associated with a network adapter. MAC addresses are linked to the hardware of the network adapters, hence they are also known as the "hardware address" or "physical address." MAC addresses uniquely identify the adapter ... Read More

Difference Between Anode and Cathode

Manish Kumar Saini
Updated on 19-Aug-2022 12:36:19

1K+ Views

Any electric circuit element or device has terminals for making connection in the circuit. These terminals of the element are also called electrodes of the element. The electrodes are classified in two types namely anode and cathode. This article is meant for explaining the difference between anode and cathode. But, before discussing the difference, we should get the basics of anode and cathode so that the understanding of differences between them becomes easier. What is Anode? An electrode of a device such as cell, battery, diode, etc. where oxidation reaction (loss of electrons) occurs is known as anode. In simple ... Read More

Difference Between Alternator and Generator

Manish Kumar Saini
Updated on 19-Aug-2022 12:33:13

6K+ Views

Both alternator and generator are types of electromechanical energy conversion devices that convert mechanical energy into electrical energy, however there are several differences in the way they operate. This article will help you understand the major differences between an alternator and a generator. Let's start with a basic overview of what Alternators and Generators are. What is an Alternator? An electromechanical energy conversion device which converts mechanical energy into AC (alternating current) electrical energy is called an alternator. An alternator consists of two main parts namely stator and rotor. The stator carries the armature winding whereas the rotor carriers ... Read More

Difference Between ACB and VCB

Manish Kumar Saini
Updated on 19-Aug-2022 12:30:15

30K+ Views

A circuit breaker is an electrical switching device that can open or close an electric circuit either normally or in case of fault. Therefore, a circuit breaker is one of the major component of an electrical power system or wiring system. A circuit breaker is usually equipped with a control mechanism which enable it to operate automatically in case of abnormal conditions in the circuit. Since the different electrical systems operate at different voltage and current levels. Therefore, according to system voltage and current, there are various types of circuit breakers available such as MCB (Miniature Circuit Breaker), ACB (Air ... Read More

Advertisements