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
How to append an item into a JavaScript array?
To append an item to a JavaScript array, use the push() method.
Example
You can try to run the following code to append an item:
<html>
<body>
<script>
var arr = ["marketing", "technical", "finance", "sales"];
arr.push("HR");
document.write(arr);
</script>
</body>
</html>
Output
marketing,technical,finance,sales,HR
Advertisements