- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
write about the arithmetic operator in javascript?
JavaScript arithmetic operators include Addition, subtraction, Division, Multiplication. let's see some of them
1) Addition and modulus operators
Example
<html> <body> <p id="add"></p> <script> var tot = 0; var a = [1,2,3,4,5,6,7,8,9] for (var i = 0; i < a.length; i++) { if(a[i]%2 == 0) { tot += a[i] } } document.getElementById("add").innerHTML = tot; </script> </body> </html>
Output
20
2) Multiplication operator
Example
<html> <body> <p id="mul"></p> <script> var pro = 1; var a = [1,2,3,4,5,6,7,8,9] for (var i = 0;i<a.length;i++) { pro *= a[i] } document.getElementById("mul").innerHTML = pro; </script> </body> </html>
Output
362880
- Related Articles
- Java Arithmetic Operator Examples
- Explain about add and assignment(+=) operator in detail in javascript?
- Explain about logical not(!) operator in detail with example in javascript?
- Write about herbs .
- Write about Nutrition.
- Write about movement in plants.
- The new operator in JavaScript
- What are Arithmetic Operators in JavaScript?
- Write about Heterotrophic plants.
- Some Interesting Observations about C/C++ Ternary Operator
- Instanceof operator in JavaScript
- Write about Financial breakeven in financial management.
- Write in brief about the hormones other than sex hormones.
- Finding the missing number in an arithmetic progression sequence in JavaScript
- How to use the "in" operator in JavaScript?

Advertisements