Categories
5G Network
Agile
Amazon EC2
Android
Angular
Ansible
Arduino
Artificial Intelligence
Augmented Reality
AWS
Azure
Big Data
Blockchain
BootStrap
Cache Teachniques
Cassandra
Commercial Insurance
C#
C++
Cloud
CD
CI
Cyber Security
Data Handling
Data using R
Data Science
DBMS
Design-Pattern
DevOps
ECMAScript
Fortify
Ethical Hacking
Framework
GIT
GIT Slack
Gradle
Hadoop
HBase
HDFS
Hibernate
Hive
HTML
Image Processing
IOT
JavaScript
Java
Jenkins
Jira
JUnit
Kibana
Linux
Machine Learning
MangoDB
MVC
NGINX
Onsen UI
Oracle
PHP
Python
QTP
R Language
Regression Analysis
React JS
Robotic
Salesforce
SAP
Selenium
Service Discovery
Service Now
SOAP UI
Spark SQL
Testing
TOGAF
Research Method
Virtual Reality
Vue.js
Home
Recent Q&A
Feedback
Ask a Question
How To Create Arrays In Javascript?
Home
>
JavaScript
>
How To Create Arrays In Javascript?
Dec 3, 2019
in
JavaScript
Q: How To Create Arrays In Javascript?
#javascript-array
1
Answer
0
votes
Dec 3, 2019
We can declare an array like this
var scripts = new Array();
We can add elements to this array like this
scripts[0] = "PHP";
scripts[1] = "ASP";
scripts[2] = "JavaScript";
scripts[3] = "HTML";
Now our array scrips has 4 elements inside it and we can print or access them by using their index number. Note that index number starts from 0. To get the third element of the array we have to use the index number 2 . Here is the way to get the third element of an array.
document.write(scripts[2]);
We also can create an array like this
var no_array = new Array(21, 22, 23, 24, 25);
JavaServer Faces (JSF) Interview Questions
Click here to read more about JavaScript
Click here to read more about Insurance
Facebook
Twitter
LinkedIn
Related questions
0
votes
Q: Can arrays in JavaScript be extended?
Feb 6, 2020
in
JavaScript
#javascript-extension
0
votes
Q: Can we create Cookie in Javascript if yes then how to create that?
Aug 24, 2020
in
JavaScript
#javascript
0
votes
Q: How to create a Cookie using JavaScript?
Oct 19, 2019
in
JavaScript
cookie-access
cookies
javascript-cookies
0
votes
Q: How can you create an Array in JavaScript?
Oct 19, 2019
in
JavaScript
javascript-object
object-in-javascript
javascript-array
array-in-javascript
0
votes
Q: How can you create an Object in JavaScript?
Oct 19, 2019
in
JavaScript
javascript-object
object-in-javascript
0
votes
Q: Which is the correct way to create an array in JavaScript? I) var myProg = []; II) var myArray = ["C","Java","C++","Python"]; III) var myProg = new Array();
Feb 6, 2020
in
JavaScript
#java-script-array
...