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
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
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
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
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
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
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
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
This tutorial will discuss how to write a Swift program to find sum of even fibonacci terms till number N. A series of numbers in which every number is the sum of the two preceding numbers is known as Fibonacci series. The starting number of the Fibonacci series is 0 and 1, so the series is − 0, 1, 1, 2, 3, 5, 8, 13, 21, …… A number that is multiple of two is known as the even number. Or in other words, a number that is completely divisible by two is known as even number. For example, 2, ... Read More
This example demonstrates how to parse JSON on Android using KotlinStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.ktimport android.os.Bundle import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import org.json.JSONException import org.json.JSONObject class MainActivity : AppCompatActivity() { lateinit var textViewName: TextView lateinit var textViewSal: TextView var jsonString = "{"employee":{"name":"tutorialspoint", "salary":65000}}" lateinit var name:String lateinit var salary:String override ... Read More