
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Add and Assignment Plus Operator in JavaScript
add and assignment(+=) operator
The add and assignment(+=) operator reduces the code little bit.It may not much influential in small codes whereas coming to long codes it's use can't be ignored.
Example
<html> <body> <script> var tot = 0; var a = [1,45,78,9,78,40]; for(var i = 0; i<a.length;i++){ tot += a[i] } document.write(tot); </script> </body> </html>
Output
251
Advertisements