MJE13003 NPN Transistor Datasheet, Pinout, Features & Applications
Hi Friends! Hope you’re well today. I welcome you on board. In this post today, I’ll demonstrate the Introduction to MJE13003.
MJE13003 is an NPN silicon transistor mainly used for high-speed high voltage power switching applications. This chip is a three-terminal device where a small current at one terminal is used to produce a large current at the remaining terminals. The collector current is 1.5A which projects this device can support load up to 1.5A.
I suggest you buckle up as I’ll describe the complete Introduction to MJE13003 covering datasheet, pinout, working principle, applications, power ratings, and physical dimensions.
Let’s get started.
Introduction to MJE13003
- MJE13003 is a bipolar junction transistor that belongs to the NPN transistor family. It is mainly used for switching and amplification purposes and comes in the TO-220 package.
- The power dissipation of this device is 40W which is the amount of power released during the working of this device.
- MJE13003 is a power transistor that comes with three terminals known as emitter, base, and collector. The small input current at the base pin is used to induce a large output current at the emitter and collector terminals.
- Bipolar junction transistors are the type of transistors where two charge carriers i.e. holes and electrons, play a vital role in the conductivity of the device.
- Bipolar junction transistors are divided into two types where one is an NPN transistor and the other is a PNP transistor.
- In NPN transistors, both electrons and holes are responsible for the conductivity of the device, however, electrons are major charge carriers in this case while holes are minority carriers.
- Similarly, both electrons and holes play a vital role in the conductivity of PNP transistors but here holes are majority carriers and electrons are minority carriers.
- Moreover, current flows from emitter to collector terminal in PNP transistors while in the case of NPN transistors current flows in opposite direction i.e. from collector to emitter terminals.
- When comparing NPN transistors with PNP transistors, the NPN transistors are preferred over PNP transistors because electrons can flow faster than holes, making PNP devices more valuable for a range of applications.
- These bipolar junction transistors are current-controlled devices while MOSFETs are the type of transistors that are voltage-controlled devices and carry terminals named drain, source, and gate.
MJE13003 Datasheet
It is wise to scan through the datasheet of the component before you incorporate this device into your electrical project. The datasheet features the main characteristics of the device. You can download the datasheet of MJE13003 by clicking the link below.
MJE13003 Pinout
MJE13003 is a power transistor that comes with three terminals named:
- Base
- Collector
- Emitter
The following figure shows the pinout diagram of MJE13003.
- The external electrical circuit is connected with this transistor through these terminals. All these terminals come with different doping concentrations.
- The emitter pin is highly doped while the collector pin is lightly doped. And the base terminal is 10-times more doped than the collector pin.
- And large current at the emitter and collector terminals is produced by using the small current at the base terminal.
MJE13003 Working Principle
- The base pin is the location responsible for the entire transistor action. When you apply a voltage at the base pin, it will bias the device and as a result, the current will start flowing from collector to emitter terminal.
- As this is an NPN transistor so here electrons are the major carriers and holes are minority carriers.
- Know that bipolar junction transistors are not symmetrical devices. Which projects if you interchange the emitter and collector terminal, it will prevent the terminals to work in forward active mode, and thus both terminals will start working in reverse active mode.
- Exchanging these terminals will also influence the values of common-base current gain and common-emitter current gain.
MJE13003 Absolute Maximum Ratings
The following table shows the absolute maximum ratings of MJE13003.
Absolute Maximum Ratings of MJE13003 |
Pin No. |
Pin Description |
Pin Name |
1 |
Collector-emitter voltage |
400V |
2 |
Collector-base voltage |
700V |
3 |
Base-emitter voltage |
9V |
4 |
Collector current |
1.5A |
5 |
Power dissipation |
40W |
6 |
Base current |
0.75A |
7 |
Operating and storage junction
temperature range |
-55 to 150C |
- The total power dissipation of this device is 40W which is the amount of power released during the functioning of this device.
- While collector-base voltage is 700V and collector-emitter voltage is 400V. The emitter-base voltage is 9V which shows the amount of voltage required to bias this device.
- When you’re working with the component, make sure the ratings don’t surpass the absolute maximum ratings. Otherwise, they can badly damage the device, thus the entire project.
- Also, don’t apply these ratings more than the required time, else they can affect device reliability.
MJE13003 Applications
MJE13003 is employed in the following applications.
- Used in modern electronic circuits.
- Used in the switched-mode power supply.
- Used in voltage regulator circuits.
- Used for switching and amplification purpose.
- Used in Bistable and Astable multivibrators circuit.
- Used to support loads under 1.5A.
- Used in H-bridge circuits.
- Used in the motor control circuit.
MJE13003 Physical Dimensions
The following figure shows the physical dimensions of MJE13003.
Using these dimensions you can evaluate the space required to install this device into the electrical circuit.
That was all about the Introduction to MJE13003. Hope you’ve enjoyed reading this article. If you have any questions, you can approach me in the comment section below. I’m willing and happy to help you the best way I can. You are most welcome to share your feedback and suggestions around the content we share. They help us produce quality content tailored to your exact needs and requirements. Thank you for reading the article.
2-bit Full Subtractor in Proteus ISIS
Hello mentees! Welcome on the behalf of
The Engineering Projects. We are here with a new lesson about the Digital Logic Circuits. Logic Circuits work as heart in many electronic Circuits. The topic of today is Full Subtractor in Proteus and you will find the answers of the following questions:
- What are 2 bit Full Subtractors?
- How can we design the Truth Table of 2 bit Full Subtractor?
- How can we implement the 2 bit Full Subtractor in Proteus ISIS?
You will also learn some important chunks of information in the
DID YOU KNOW sections.
2 bit Full Subtractors
A full Subtractor works really well in the processor. We’ll talk about it function but before that have a look at its definition:
- 2 bit Full Subtractor is a Combinational Logic that contain three Inputs and Two outputs and perform the function of Subtraction with two bits.
- Minuend: The 1st input is called the Minuend used to take the bit from which the 2nd value will be Subtracted.
- Subtrahend: It is called the 2nd input that is subtracted from Minuend.
- Borrow in: It is the third input that is use to take the value of the Previous borrow and we’ll denote it as B(in) here.
- Borrow Out: The Borrow out is symbolized as B(out) and it the resultant borrow that the output Terminal shows.
- Difference: This is the main result that was the concern of the experiment and its value totally depends upon the binary subtraction rules.
DID YOU KNOW?????????????????
There is another circuit called Half Subtractor that is used for the subtraction of bits but the foremost disadvantage of that circuit was its inability to work with the borrow taken in the previous calculation and the designers worked for another better Subtractors.
Truth Table of 2-bit Full Subtractor
If you know about the Concept of binary subtraction, you can use your knowledge to generate a Truth Table of 2 bit Full Subtractor so that one can design a feasible Circuit of 2 bit Full Subtractor. The Table contain all the records that can be possible for our experiment and its result into the bargain. Thus the Truth Table for the Full Subtractor is shows as:
Minuend |
Subtrahend |
B(in) |
Difference |
B(out) |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
1 |
Working Mechanism of 2 bit Full Subtractor
When we observe the Circuit of 2 bit Full Subtractor, we found that it is combination of two circuits of Half subtractors and the output of each circuit is then fed into an OR Gate through which we get the output of borrow. We have two types of outputs in the 2 bit Full Subtractor:
- Difference
- Borrow
DID YOU KNOW?????????????????
The Full Subtractor is the one of the most fundamental Logic circuits of that are used for two bit subtraction in many computing system.
Let's have a look at the procedure of calculation of both.
Difference
The binary subtraction is similar to the decimal subtraction but it works with only two digits called 0 and 1 instead of 1 to 10 in the decimal. When we examine the answer of the bit difference while using a Truth Table in the Half Subtractor circuit, we found that it is identical to the XOR Gate. Therefore we use a XOR Gate for the Difference that is introduced as:
The type of Logic Circuit that gives the output HIGH only when both its inputs have inverse value to each other and vise versa.
Thus the truth table for the XOR Gate is given as:
A |
B |
A XOR B |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
0 |
The output of the XOR Gate is Fed into another XOR Gate for the Full subtraction which has the connection of a Borrow Input B(in) at its Second input.
DID YOU KNOW???????????????
The Application of the Full Subtractor is found in the ALU of computer where they are responsible for the Graphic application to decrease the difficulty in the CPU and GPU.
Borrow
Many times, the situation arrives when the Minuend<Subtrahend and in this way, the circuit need to borrow a bit from the bit presented just after it. The Full Subtractor do this through the AND Gate that contain a NOT Gate at its one end. For full Subtractor, this arrangement is again fed into the duplicated circuit and the both the outputs of this AND Gate is fed into the OR Gate that gives us the Borrow(out).
2 bit Full Subtractor in Proteus ISIS
- Start up your Proteus Software.
- Collect the following devices from the Pick Library.
Devices Required
- XOR Gate
- AND Gate
- OR Gate
- Logic Toggle
- LED-Red
- Arrange the XOR Gate, AND Gate and NOT Gate at the working area according to the arrangement given below:
- This will form a Half Subtractor. Select the devices through a square selection area.
- Copy the whole arrangement through left click>copy to clip board.
- Paste the arrangement in the side of the circuit.
- Add an OR gate at the right side of the system. The screen should look like the image given below:
- Add three Logic Toggles at the left most side of the arrangement.
- Connect the Whole circuit through connecting wires by matching the circuit with the following image:
- This is the Full Subtractor circuit. Change the values of the Probes according to the Truth Table and record your observation.
Consequently, Today we learned very useful circuit of Logic Design. We saw what are 2 bit Full Subtractor, how can we design a Truth Table of 2 bit Full Subtractor, what is the basic mechanism behind the working of 2 bit Full Subtractor and how can we perform a Practical implementation of 2 bit Full Subtarctor using Proteus ISIS.
In the next session, we'll learn how can we simulate a four bit Full Subtractor in Proteus ISIS and its basic concepts.
D13009K NPN Transistor Datasheet, Pinout, Power Ratings & Applications
Hello Folks! I welcome you on board. Happy to see you around. In this post today, I’ll walk you through the Introduction to D13009K.
D13009K is a high voltage fast switching power transistor that falls under the category of NPN transistors. The collector current of this device is 12A which projects it can endure load under 12A. This chip is mainly used in amplification and switching applications. The small current change at one pair of terminals is used to produce a large current change across the remaining terminals. The power dissipation is 100W which features the amount of power this chip dissipates during the working of this integrated chip.
I recommend you check out this post all the way through as I’ll demonstrate the complete Introduction to D13009K covering datasheet, pinout, power ratings, applications, and physical dimensions.
Let’s get started.
Introduction to D13009K
- D13009K is an NPN bipolar junction transistor that is a high voltage fast switching power device. It is widely employed for switching and amplification purposes.
- This component contains three terminals named base, collector, and emitter. It generates a large current across emitter and collector terminals by changing a small current at the base side. This phenomenon is used for amplification purposes.
- The emitter-base voltage is 9V which details that it requires 9V to start the transistor action and bias this device.
- D13009K contains three layers. Two are n-doped layers and one is a p-doped layer. The p-doped layer sits between the two n-doped layers.
- Bipolar junction transistors are divided into two main types i.e. PNP transistors and NPN transistors.
- The D13009K is an NPN transistor where electrons are the major charge carriers. It is important to note that these devices are called bipolar devices because both holes and electrons are responsible for the conductivity inside the transistor.
- In NPN devices, electrons are the major charge carriers and in PNP devices, holes are the major carriers. Moreover, NPN transistors are preferred over PNP transistors since the mobility of electrons is faster and efficient than the mobility of holes.
- This bipolar junction transistor is a current-controlled device as opposed to MOSFETs that are voltage-controlled devices and carry pins like a drain, source, and gate. The drain side replaces the emitter, the source replaces the collector and the gate replaces the base pin in bipolar junction transistors.
D13009K Datasheet
Before you embed this chip into your electrical project, it’s wise to check out the datasheet of the device that features the main characteristics of the device. Download the datasheet of D13009K by clicking the link below.
D13009K Pinout
This power transistor contains three terminals named:
- Base
- Collector
- Emitter
The following figure shows the pinout diagram of D13009K.
The doping concentration of all these terminals is different. The collector pin is lightly doped while the emitter pin is highly doped. The base pin is 10-times more doped than the collector side.
D13009K Working Principle
- This device comes with high breakdown voltage and carries high current capability. It is a highly reliable product and features a high switching speed.
- The working of this device starts from the base pin. When you apply voltage at the base terminals, it will bias the device and start the transistor action. And current starts flowing from collector to emitter terminal.
- In NPN transistors current flows from collector to emitter terminal and in PNP transistors current flows from emitter to collector terminal.
- These bipolar devices are not symmetrical. This means if you try to exchange the collector and emitter side, it will prevent the terminals to work in forward active mode and force the terminals to work in reverse active mode.
- The different doping concentration of these devices is responsible for the lack of symmetry in these transistors.
D13009K Power Ratings
The following table features the absolute maximum ratings of D13009K.
Absolute Maximum Ratings of D13009K |
Pin No. |
Pin Description |
Pin Name |
1 |
Collector-emitter voltage |
400V |
2 |
Collector-base voltage |
700V |
3 |
Base-emitter voltage |
9V |
4 |
Collector current |
12A |
5 |
Power dissipation |
100W |
6 |
Base current |
6A |
7 |
Operating and storage junction
temperature range |
-55 to 150C |
- When you’re working with the component, make sure the ratings don’t exceed the absolute maximum ratings. Otherwise, it can affect the entire project.
- The collector-emitter and collector-base voltages are 400V and 700 respectively. And total power dissipation is 100W which shows the amount of power released during the working of this chip. The junction temperature and storage temperature ranges from -55 to 150C.
- Plus, don’t apply these ratings more than the required time, else they can affect device reliability.
D13009K Applications
D13009K is used in the following applications.
- Used in energy-saving lights.
- Used in Bistable and Astable multivibrators circuit.
- Used in high-frequency power transform.
- Employed to support loads under 12A.
- Used in voltage regulator circuits.
- Used in a common power amplifier.
- Incorporated in modern electronic circuits.
- Used in electronic Ballasts.
- Used in the high switching power supply.
D13009K Physical Dimensions
The image below shows the physical dimensions of D13009K.
By reading those dimensions you can evaluate the space required for your component in the electrical project.
That’s all for today. Thank you for reading this entire post. You are most welcome to share your valuable feedback and suggestions around the content we share so we keep producing quality content based on your exact needs and requirements. You can approach me in the section below if you need any help regarding this article, I’m happy and willing to help you the best way I can. Thank you for reading this article.
MJE13007 NPN Transistor Datasheet, Pinout, Features & Applications
Hello Everyone! Happy to see you around. Thank you for clicking this read. In this post today, I’ll document the Introduction to MJE13007.
MJE13007 is an NPN bipolar junction transistor that is a semiconductor device made of silicon material. This chip is mainly used for amplification and switching purposes. The collector-base voltage is 700V while the collector-emitter voltage is 400V. The power dissipation at temp 25C is 80W. This means 80W is released during the working of this device. This device can support load up to 8A because the current at the collector side is 8A.
I suggest you read this entire post till the end as I’ll include the complete Introduction to MJE13007 covering datasheet, pinout, working principle, power ratings, applications, and physical dimensions.
Let’s get started.
Introduction to MJE13007
- MJE13007 is an NPN bipolar junction transistor mainly used for high voltage high-speed switching applications.
- Three layers are used for the construction of this device. One is a p-doped layer that stands between two n-doped layers.
- MJE13007 includes three terminals named base, collector, and emitter. The small input current at the base side is used to generate a large output current across the emitter and collector terminals.
- The emitter-base voltage is 9V which means this device requires 9V to initiate the transistor action.
- Bipolar junction transistors come in two types i.e. NPN transistors and PNP transistors. This device MJE13007 falls under the category of NPN transistors where electrons are the major carriers while in the case of PNP transistors holes are the major carriers.
- It is important to note that in bipolar junction transistors both electrons and holes are involved in the conductivity inside the transistors but holes are majority carriers in PNP transistors while electrons are major carriers in NPN transistors.
- The mobility of holes is less efficient than the mobility of electrons, making NPN transistors a better choice for the range of applications.
- Moreover, the current flows from emitter to collector in PNP transistors while it flows from collector to emitter in NPN transistors.
- Transistors are mainly divided into two main types’ i.e. bipolar junction transistors and MOSFETs. The bipolar junction transistor are the current-controlled device while MOSFETs are the voltage-controlled devices that include terminals known as a drain, source, and gate.
MJE13007 Datasheet
Before you apply this device to your electrical project, it is wise to scan through the datasheet of the device that details the main characteristics of the device. Click the link below to download the datasheet of MJE13007.
MJE13007 Pinout
The MJE13007 includes three terminals named:
- Base
- Collector
- Emitter
The following image represents the pinout diagram of MJE13007.
The small current at the base side is used to control the large current at the remaining terminals. All these terminals are used for the external connection with the electronic circuit.
While the collector side is lightly doped. The base side is 10-times more doped than the collector side.
MJE13007 Working Principle
- The base side is responsible for the overall transistor action. When voltage is applied at the base pin, it gets biased, and current will start flowing from the collector to the emitter terminal.
- This device MJE13007 is not a symmetrical device. The lack of symmetry is due to the difference in the doping concentration of all three terminals.
- If you try to exchange the emitter and collector terminals, it will prevent the device from working in forward active mode and as a result, both terminals will start working in reverse active mode, influencing the values of both common-emitter current gain and common-base current gain.
MJE13007 Power Ratings
The following table shows the absolute maximum ratings of MJE13007.
Absolute Maximum Ratings of MJE13007 |
Pin No. |
Pin Description |
Pin Name |
1 |
Collector-emitter voltage |
400V |
2 |
Collector-base voltage |
700V |
3 |
Base-emitter voltage |
9V |
4 |
Collector current |
8A |
5 |
Power dissipation |
80W |
6 |
Base current |
4A |
7 |
Operating and storage junction
temperature range |
-55 to 150C |
- The power dissipation is 80W which is the amount of power that will dissipate during the working of this device. The collector-base voltage is 700V and the collector-emitter voltage is 400V.
- The emitter-base voltage is 9V which is the amount of voltage that you will apply to bias the device and start the transistor action.
- When you’re working with this chip, make sure the ratings don’t exceed the absolute maximum ratings. Otherwise, they can severely damage the device, thus the entire project.
- Moreover, don’t apply these ratings more than the desired time, else they can affect device reliability.
MJE13007 Applications
The following are the main applications of the MJE13007 NPN transistor.
- Incorporated in modern electronic circuits.
- Employed in the switched-mode power supply.
- Employed to support loads under 8A.
- Installed in the motor control circuit.
- Used in voltage regulator circuits.
- Used for switching and amplification purpose.
- Used in H-bridge circuits.
- Used in Bistable and Astable multivibrators circuit.
MJE13007 Physical Dimensions
The following figure presents the physical dimensions of MJE13007.
By reading the physical dimensions you can get a hold of the space required to install this device into the relevant project.
That’s all for today. Hope you find this article helpful. You are most welcome to share your feedback and suggestions around the content we share so we keep coming back with quality content tailored to your exact needs and requirements. You can approach me in the section below, for any query regarding this article. I’m happy and willing to help you the best way I can. Thank you for reading the article.
Mathematical Operators In JavaScript
Hello everyone, I hope you are fine. In today's tutorial, we are gonna take a look at “Mathematical operators in JavaScript” in detail. Performing math operator in different programing language is very common. JavaScript also allows several operators to help us in numbers.
The mathematical operator in JavaScript is used for performing certain different tasks such as the final price of a financial transaction, browser windows size and calculating the range between the element in a website document.
There are two types of operator that I am going to discuss in this tutorial.
- Arithmetic operator
- Assignment operator
Arithmetic Operators in JavaScript
To perform an action between two variable or values we use mathematical operators. In the equation 3+2 = 5 (+ is a syntax).
Java script has many different operators some are basic math operator and others are additionals operators particular to programming.
A table of JavaScript Operators
Operator |
Description |
Example |
Definition |
+ |
Addition |
2 + 3 |
Sum of 2 and 3 |
- |
Subtraction |
9 - 2 |
Difference of 9 and 2 |
* |
Multiplication |
3 * 2 |
Product of 3 and 2 |
/ |
Division |
10 / 5 |
Division of 10 and 5 |
% |
Modulo |
9 % 2 |
Remainder of 9 and 2 |
** |
Exponentiation |
9 ** 3 |
9 to the 3 power |
++ |
Increment |
9++ |
9 plus one |
-- |
Decrement |
9-- |
9 minus one |
Let me explain to you all of these operators in detail.
Addition and Subtraction in JavaScript
Addition and subtractions are the operators from basic maths. They are used to find the sum and difference of two numerical values. JavsScript has its own built-in calculator. All these mathematical operators can be directly performed in the console.
As you have seen a simple example of addition and now I am going to explain it with detail. Now I will assign numerical values to a and b and place the sum in c.
- Assign the value to a and b
- Suppose: a = 3; b = 4;
- Now add a + b and assign the sum of a+b to c
- c = a + b; alert(c);
Output
In a similar way, subtraction(-) also work with the same formula but will subtract the number.
- Assign the value to a and b
- Suppose: a = 6; b = 3;
- Now subtract a - b and assign the diffrence of a-b to c
- c = a - b; alert(c);
Output
We can also do add and subtraction by the float (decimals) and negative numbers. Look below with an example.
- a = -6.3; b = 3.5;
- Now subtract a - b and assign the difference of a-b to c
- c = a - b; alert(c);
Output
There is one another fact about the (+)operator that you should know that adding a numeric number and string. As we all know that 1 + 2 return the value of 3. But this will have an unexpected result.
- Suppose c = 1 + “2”;
- alert(c)
Output:
The result of this will be 12 because of the one string value(“2”), javascript concatenate (Concat() function is used to join two or more string together) it rather than adding 1 and 2. So it is really important to be careful because while coding in JavaScript. Therefore JavaScript is case sensitive language.
Multiplication in JavaScript
Multiplication (*) and division (/) are also used in Javascript to find the numeric values by division or multiplication. Multiplication could be used many times like calculating the price of any item etc and division help you in finding the time like the number of hours or minutes.
- Suppose x = 10; y = 5;
- z = x * y;
- alert(z);
Output
Divison Operator in JavaScript
- suppose x = 100; y=10;
- z = x / y;
- alert(z);
Output
Modulus in JavaScript
Modulo (%) is used to find the remainder of a quotient after division. It can help us find in that even if the number is even or odd. It is less familiar operator than others. It is also known as
Modulus too.
- Let suppose x = 11; y = 5;
- z = x % y;
- alert(z);
Output
Exponentiation in JavaScript
Exponentiation (**) is the new operator in JavaScript. Its calculate the power of a number by its exponent. Its written like this 8^4 (Eight to the 4 power).
- x = 8; y = 4;
- z = 8 ** 4;
- alert(z);
Output
8 ** 4 represents the same as 8 multiplied by 8 four times:
8 * 8 * 8 * 8
Increment and Decrement in JavaScript
The
increment operator (++) increase the numerical value of a variable by one and on the other side
decrement operator (--) decrease the numerical value of a variable by one. They are often used with loops.
You can use these operators with variable only and using them with raw numbers can only result in an error. Look in the example.
Increment and Decrement are further divided into two classes:
prefix operation and
postfix operation. Firstly, prefix operator.
let x = 8;
prefix = ++x;
alert(prefix);
Output
Postfix Operator in JavaScript
let x = 8;
postfix = x++;
alert(postfix);
Output
The value of x is not increased in this postfix operator, The value of the x will not be increased until after the expression has been evaluated. But running the operation twice will increase the value.
As you can see in the image that I have increased the value of x.
Now see the
output.
All these increment and decrement operators are used in
for loops most of the time.
Assignment Operators in JavaScript
The assignment operator
(=) is the most used operator, which we have used already. We used the assignment operator to assign the value to the variable.
//Assign 50$ to price variable
Price = 50$
JavaScript also contains
compound assignment operators. Let's discuss a compound assignment operator example.
//Assign 50$ to price variable
Price = 50$
Price += 5$;
alert(price);
The output of this result will be
55$. In this case, price += 5$ is same as price = price + 5$.
The arithmetic operator can be combined with the assignment operator to make a
compound assignment operator. Down below is a table of the assignment operator.
Description |
Operator |
Assignment |
= |
Addition assignment |
+= |
Subtraction assignment |
-= |
Multiplication assignment |
*= |
Division assignment |
/= |
Exponentiation assignment |
**= |
Remainder assignment |
%= |
In this article, we have discussed the arithmetic operator and their syntax in detail. If you have a question regarding this post you can ask me. I will reply to all of your queries.
Lastly, thank you for reading this article, and we are working hard to deliver you best content.
While Loop In JavaScript
Hello friends, I hope you all are feeling great today. In today’s tutorial, we will have a look at a detailed “While Loop In JavaScript” topic. It’s our 8th tutorial in JavaScript Series.
Loops are used in programming and they offer the easiest and quickest way to do a repetitive task. In this article, we will learn about While and do..while statements as they are the most basic type of Loops.
For example, if we want to display the same line “I am learning JavsScript” 10 times. Then this can be done with the help of loops easily rather than typing long code. It will save your time and energy.
While Loop in JavaScript
In JavaScript, while loops loop through a block of code until the specified condition is true. The condition is evaluated before executing the statement.
The syntax of the while loop is very similar to if statement.
Syntax
while (condition) {
// execute this code as long as the condition is true
}
In the following example, we have to take a variable i = 1, and the while condition is that when it executes it should be less than 5. For each iteration of the loop, we will add one number.
Output
When we will run the above example, we will receive the following result.
Infinite Loop using While in JavaScript
You might have already the idea what Infinite loop is because of its name. An infinite loop is a loop that will keep running forever. If you make an infinite loop by accident it can crash your browser. So it is really important the awareness of infinite loop otherwise can crash your computer or browser.
Look at the example of the infinite loop.
// Start a infinite loop
while (true) {
// execute code forever
}
Do While Loop in JavaScript
We have learned upside about while loop. The while loop will run a block of code until the specified condition is true.
Do..while statement is slightly different from
while statement, it evaluates the condition at the end of each loop irritation. And do...while condition always executes once even if the condition is never true.
Syntax
do {
// execute code
} while (condition);
I am going to show you the same example with do..while loop so you can understand the difference between them.
Output
In the following example javascript, we have started variable with i = 1. Now it will print the output and increase the value of the variable
i by 1. When the condition will be evaluated loop will continue to run until the variable i is less than 5 or equal to 5.
In this tutorial, we have learned about while loop and do-while loop and the difference between them. We also discussed the infinite loop and how it can you save yourself from crashing your browser.
This is the last tutorial of loop and if you want to learn more about loops like
for...loop, for..in loop and
for..of loop then go visit
for loop in JavaScript.
That's it for today, for more content like this that add value to your life. Keep visiting our website. Comment below if you want to ask anything.
For Loop In JavaScript
Hello folks, I hope you are doing great in your life. In today’s tutorial, I am going to talk about “For Loop In JavaScript”. This is our 7th tutorial of the JavaScript series.
Loops are designed in JavaScript to automate the repetition task. You may have encountered a lot of time in programming that you have to repeat an action again and again. To help you in reducing the number of lines code and time, loops were created.
There are five types of loops JavaScript have:
- For Loop
- For...In Loop
- For...of Loop
- While Loop
- Do While Loop
For Loop in JavaScript
For Loop will run the same code of block again and again repeatedly, for a specific number of time or as long as a certain condition is met.
The For loop of JavaScript is similar to C language and Java for Loop.
Syntax
for (initialization; condition; final expression) {
// code to be executed
}
The for loop is the most concise part of looping. There is three expression use in for Loop initialization, condition, and final expression.
For Loop Syntax in JavaScript
- The first step is initialization where you have to assign a value to a variable and that variable will be used inside the loop. The initial statement is executed before the loop begin.
- The test condition or statement will evaluate that if it is true or false. And if it would be true then the loop statement executes or otherwise, the execution of the loops ends.
- The final expression is the iteration statement where you can increase or decrease your statement.
Let me show you a simple example of for loop.
As you can see in the image that firstly, we
initialize the
for loop with let
i = 0;. Its means that the loop begins with 0.
Afterwards, we declared the condition to be
i < 4; means that the loop will continue to run as long as i is less than 3. Our last expression is
i++, it will increase by 1 each time the loops runs.
Output
Optional Expressions in Javascript For Loop
All of these three expressions in
for loop are optional. we can write the
for statements without initializations. Look at the demonstration for more clarity.
// declare variables outside the loop
var i = 5;
for( ; i<10; i++;) {
document.write("<p> 'The number is + i +' </p>")
}
Output
- The number is 5
- The number is 6
- The number is 7
- The number is 8
- The number is 9
As you can see that it is necessary to put a semicolon
; whether it is empty. We can also remove the condition from the room. For this, we can use
if statement combined with a break. This break is for the loop to stop running once
i is greater than 10.
// declare variables outside the loop
var i = 5;
for( ; ; i++;) {
if(i < 10) {
break
}
document.write("<p> 'The number is + i +' </p>")
}
Output
The number is 5
The number is 6
The number is 7
The number is 8
The number is 9
Never forget to add the
break statement. Unless the loop will run forever and potentially break the browser.
// Declare variable outside the loop
let i = 0;
// leave out all statements for ( ; ; ) {
if (i > 3) {
break;
}
document.write(i); i++; }
Output
The number is 5
The number is 6
The number is 7
The number is 8
The number is 9
For...In Loop
Syntax
for (variableName in Object)
{
statement
}
For...in loop is created to help us in providing a simpler way to iterate through the properties of an object. When you will learn about
objects, then
for..in loop will be more clear to you. Let me explain it to you with a simple example.
Output
For..of Loops
The for...of statement creates a loop for iterate over iterable objects like arrays and strings. It is the new feature of ECMAScript (or ES), ECMAScript 6.
Syntax
for (variable of object)
statement
In the following example, we will create a
for...of loop.
Output
In this article, we learn about What are loops and how to construct the
For Loops In JavaScript and about
for...of and
for...in statement. We will discuss while loop and do while loop in our next tutorial. I hope you have found this article informative and learn something new from it. For more tutorial of JavaScript please keep visiting our website.
If you have any question related to this tutorial, you can ask in comments and you can suggest any changes you want in the upcoming article. We love to hear your suggestion.
Switch Statement in JavaScript
Hello friends, I hope you all are doing great. In today’s tutorial, we will have a look at the detailed “Switch Statement in JavaScript”. It’s our 6th tutorial in JavaScript Series.
As we have learned about the conditional statement and its types (if, if..else, If...else if) in the last article, a conditional statement is the most useful and common feature in the programming language.
Switch is also a type of conditional statement and it will evaluate an expression against multiple possible cases and run one or more blocks of codes base on matching cases. The switched statement work almost as if...else if statement containing many blocks, and it does work so more efficiently than repeated if...else if statements.
Switch Statement in JavaScript
The switch statement is used to perform different action based on multiple cases.
How does switch statement work?
- Firstly, evaluate the expression once.
- Value of expression will be compared with each case.
- If there would be a match, the associated block of code will execute.
Syntax
switch (expression) {
case x:
// case x code block (statement x)
break;
case y:
// case y code block (statement y)
break;
default:
// execute default code block (statement default)
}
Break Keyword in JavaScript Switch Statement
As the name says break, When JavaScript reaches the break keyword, it breaks out of the switch block. It will only stop the execution of inside the block. It will continue until reaching the last break case. Eventually, reach the last case and the break keyword will end the switch block.
Default Keyword in JavaScript Switch Statement
If there is no case match then the default code block will run. There could be only one default keyword in the switch statement. The default keyword is optional, but it is recommended that you use it.
Let’s see an example of a switch statement.
Firstly, the expression will be evaluated.
The first case, 3 will be tested against the expression. The code will not execute because it does not match the expression and it will be skipped.
Then case 4 will be tested against the expression. Since 4 matches the expression, the code will execute and exit out of the switch block.
And your output will be displayed like this.
Output
Let’s make another example of a working switch. In this example, we will find the current day of the week with the new Date()method and getDay()to print a number equivalent to the current day. 0 stand for Sunday, 1 stand for Monday and then throughout till Saturday with number 6.
OutPut
This code was tested on Monday that’s why it is displaying Monday. But your output would be change depending on the day you are testing. I have added default too in case of any error.
Multiple Cases in JavaScript Switch Statement
There is a chance that you may face a code in which you have to display the same output for multiple cases.
So, we have made an example for you to understand these multiple cases.
In this example first, the new Date() method will find a number compared to the current month and then apply the month variable.
Output
In today tutorial, we review about the switch, and how it is similar to if..else if statement. We reviewed the switch statement with three different examples.
To learn more about JavaScript you can read these article series from the start. I am sure these will help you and if you have any question regarding this article. You can comment down below and ask anything.
Thank you so much for reading this article and we are doing our best to deliver you our best. Please visit again. See you in the next tutorial.
If Else Statement in JavaScript
Hello everyone, I hope you are having a fine day. In today’s tutorial, I am going to discuss the if-else statement in JavaScript and what are
conditional statements in detail.
In programming, while writing a program there may be an occasion where you need to adopt one out of a given set of paths. In such a case, you need to use conditional statements that allow your program to make the correct decision.
Conditional statements
Conditional statements are used to run a specific action based on the result of the different conditions (true or false). If the condition would be true one action would be performed and if the condition is false then another action would be performed.
A few examples of JavaScript conditional statements:
- Verify the location of the user and display the language based on the country
- Send a form on submit, display a missing required field warning next in the missing field.
- Show a booking form for a bus ticket but not if the bus is booked.
We have the following conditions in JavaScripts.
- if statement
- if...else statement
- if...else if statement
If Statement in Javascript
If statement plays a very important role in JavaScript to make decisions. It will decide whether the statement is true or false and only run if the statement is true. Otherwise, the code block will be ignored if the statement is false.
Syntax
if (condition) {
// block of code that will excute if the condition is true
}
Note: if is a lowercase letter and If or IF will cause a JavaScript error.
A simple example to see how if statement work in javascript.
Let’s suppose you are going to pay your electricity bill through an app where you have a certain amount of money already in your account.
Your account money is 5000 and you have to pay the electricity bill of 700. Using the <= help you in finding that whether you have less than or equal to electricity bill money available to pay it. Since the Electricity_bill <= money evaluates to true. The code will run because the condition is true.
output
See another example, in case you have less money than your Electricity_bill.
This example does not have any output because of Electricity_bill <= money evaluated to false. Now the code block will be ignored and the programme will continue on the next line. And there will be nothing in output.
If Else Statement in JavaScript
In if statement code only proceeds when the condition is true but in the if-else statement whether the condition evaluates true or false it will execute.
Syntax
if (condition){
// block of code that will execute if the condition is true
} else {
block of code that will execute if the condition is false
}
As an example, to find out an even or odd number.
Output
Since the condition of if is not true then code moves to the else statement and execute it.
if-else condition is more common than only if condition. It can help users in giving warning and letting them know what decision they should make.
IF Else If Statment in JavaScript
If you want to check more than two conditions than you can use
if...else if statement.
With
if...
else statement, you can find out that if the condition is true or false. However, sometimes we have multiple possible conditions and outputs and needed more than two options. For that purpose, we can use if...else if statement.
Syntax
if(condition a) {
// block of code that will execute if condition a is true
} else if (condition b) {
// block of code that will execute if condition b is true
} else if (condition c) {
// block of code code that will execute if condition c is true
} else {
// block code that will execute if all above conditions are false }
There is no limit for
else if statement, you can add as many as you want but there is a
switch statement that would be preferred for readability.
Let's see a simple example of checking grade of students based on numbers out of 100.
Output
This tutorial provided a brief overview of conditional statement, if, if..else and if...else if statement that you can use in JavaScript. To learn more about JavaScript from the first article you can read
Introduction to JavaScript.
Thank you for visiting our website. You have any question regarding this post feel free to comment below and ask any question related to this post. We are looking forward to hearing from you.
Introduction to Bitcoin - A Comprehensive Beginner Guide
Hi folks, I hope you guys are doing great. In my previous post, I have discussed what cryptocurrency is. Before I go in detail about Bitcoin, let me tell you. Go and read the last article about cryptocurrency. As you should have information about cryptocurrency before jumping into bitcoin.
Bitcoin has become a buzz word now. It’s been around 12 years since Bitcoin release. A person or group of people name Satoshi Nakamoto emerge bitcoins that host a digital currency bitcoin.
The individuals who already knew about Bitcoin are curious about it that how is it going to leave an impact on our daily lives in the future. I am here to answer all of your questions and that will clear all your doubts and curiosity.
So we are going to cover all these topics down below:
- What is Bitcoin?
- Understanding of Bitcoin in Depth.
- How Does Bitcoin work?
- What is Mining?
- Useful Definition for Bitcoins wallet.
- How can I store my Bitcoins?
- Types of wallets.
- How to Buy Bitcoins?
- Pros of Bitcoin.
- Cons of Bitcoin.
- Conclusion.
Introduction to Bitcoin
- Bitcoin is the official first cryptocurrency that had been released in 2009. It is basically a digital currency and only exists electronically.
- Bitcoin becomes known in 2009 when the world economy was on the crisis. Those big banks were doing fraud with clients and manipulating the system.
- So, basically Bitcoin founder actually wants to get rid of the third party and put the seller in charge. They want to make transaction safe and secure without any interest fees and corruption.
- Bitcoin is a decentralized system, it means it doesn’t have any central hub or any insinuation like banks etc that controls the amount of Bitcoin.
- Bitcoin has come too far in such a short time. Now globally different big companies are accepting Bitcoin as currency.
Understanding of Bitcoin in Depth
Bitcoin has a different importance for different persons.
The Bitcoin process is organized and easy to understand. Bitcoin uses peer to peer technology for the transaction of Bitcoins. All of these transferred are tracked on
“Blockchain” and known as the giant ledger. This giant ledger saves all the transaction of Bitcoin that ever made.
The giant ledger records every transaction and whenever it made.
17 million bitcoins are currently in circulation. No one is yet controlling the supply of bitcoins, that’s means that supply is controlled by design. The total supply of bitcoins that will be ever created is 21 million bitcoins.
How Does Bitcoin work?
Before further getting into details about working of bitcoins, if you are not interested in the technical process then you can check my last article about cryptocurrency where you can find a simple example of bitcoin working.
As I told before, Bitcoin is decentralized and work on a giant ledger also called a blockchain. Bitcoin is a secure process and uses a great verification method which minimizes the risk of hacking and fraud.
Volunteers of bitcoin referred to as”
miners” who constantly update and verify the blockchain as you all know that bitcoin is decentralized.
When a specific amount of bitcoin transactions is verified then another block is added to the blockchain and that’s how the business continues as usual.
May you have heard the term “mining” many times when reading about bitcoins. So I will explain to you briefly today about mining.
Introduction to Mining?
As you all know now that in bitcoin there is no central hub for verifying the transaction of bitcoins. So all the people on the networks are verified each transaction.
The people who are verifying transaction are miners and all of this process will be called Mining. Mining is a process that keeps the bitcoins secure by adding the new transaction or updating it and keeping them in the ledger.
Let me explain the process simpler so you will understand.
Now you must be thinking how could a person sit 24 hours for this single process and verify and update all the procedure. Actually, there is not any human being who is doing this process but hardware are used to perform Bitcoin mining. And these hardware called miners.
Miners are presented with math problems and the first one who will solve this problem will add a new transaction (or block) in the ledger. All of these calculations are stand on
Proof of Work.
There is a reward system involved in the process of Bitcoins. The one miner who will solve first will get a reward. The reward got changes over time with the update of Bitcoin programming.
The most successful process uses in bitcoin is
ASICS–Application-Specific Integrated Circuits. ASICS are hardware systems similar to CPU but these are only designs for bitcoin mining.
All of the mining processes take a lot of power and effort. The competition is higher in this bitcoin mining and that makes it difficult for new people to enter the race and get profit.
Bitcoin wallets
There are different applications you can use to store your bitcoins in the wallet. As you all know already this is a digital currency and you can’t keep it in your pocket. But first, let me introduce you some useful definition before going further in detail.
- Exchange Platform
It is a platform where you can trade money to cryptocurrencies such as Bitcoin, Litecoin or Ethereum. You can also buy and sell one cryptocurrency to others.
- Hard Wallet
It is an offline wallet that is not linked to any network.
- Public Cryptographic Key
The Public Cryptographic Key is like your bank account number. The Public Cryptographic Key is the information you give someone to receive cryptos.
- Private Cryptographic Key
It is key that will allow you to spend your bitcoins or any other cryptocurrency. You can't share it with anyone because if you did they can steal your bitcoins or transfer to their wallets.
- Wallet platform
Wallet platform is like your bank account where all of your cryptocurrencies are kept.
How can I store my Bitcoins?
Now you can understand the bitcoin wallet terms easily. Let’s jump into it with further details.
Bitcoin has secure transaction technique and it is difficult to hack the wallet and if you had ever heard that bitcoin being hacked. It does not mean that someone wallet got hacked but it would be probably the exchange platform.
There are different wallet platforms and are extremely secure that make it impossible to hack.
It is an email server that handles all the aspect of processes without relying on any third party. It allows you to control your whole transaction from beginning to end by yourself. But sadly this is not for beginners.
A hard wallet is like a USB that allows you to store cryptocurrencies key offline. Your cryptocurrency will be only live on your hard wallet and it is not possible to hack unless someone steals your hard wallet.
A web client is opposite to Full client. It totally depends on the third party. The third party will help you to operate your all transaction.
This is an alone email client that helps you in connect to mail server to access all the email. It would store all your bitcoins but it also needs a third party server owned server to access the network and make the transaction.
Types of Bitcoin wallets
Wallet basically comes with five different main types. Each type has its own advantage and disadvantage.
- Desktop
- Mobile
- Web
- Hardware
- Paper
How to Buy Bitcoins
It was difficult to buy bitcoin in the past because of the trouble of finding a trustworthy place to buy bitcoins. But now as the popularity of bitcoins, the demand for bitcoins got increased and many new companies have decided to help in easily purchasing Bitcoins.
Now day’s bitcoins exchanges are receiving huge investments.
Coinbase is a good platform to buy and sell your bitcoins. Its got launched in 2012 and providing users with an easier way to buy bitcoins. It is the easiest ways for newcomers who want to buy bitcoins.
Gemini is another great place to buy bitcoins. It was founded in 2015 by Tyler and Cameron.
Pros of Bitcoin
- Payment can be made to anyone and at any time instantly
- Does not require any third party for the transaction
- Data of Bitcoin can’t be manipulated by any person, bank, or government
- Processing fees of bitcoins are low
- Transaction of Bitcoin can’t be reversed
Cons of Bitcoin
- Bitcoin Exchange hacks
- Mining Scams
- Lack of adoption by business
- The strength of bitcoin lies in its networking effects.
- Transactions are slow and you have to wait almost ten minutes for your network to approve
Conclusion
Everything in this world comes with advantage and disadvantage. Now it is up to you how you will use it in your life.
Bitcoin is free from third party interference and manipulations. It is a transparent system where you are aware that what is happening with your money. Bitcoin is going to grow stronger when most of the people will be aware of its efficiency.
NOW it is time for your respond. What do you think about bitcoins? Comment down below for any further query and suggestions.