Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Ask a Question
How can you create an Array in JavaScript?
Home
JavaScript
How can you create an Array in JavaScript?
asked
Oct 19, 2019
in
JavaScript
by
SakshiSharma
How can you create an Array in JavaScript?
javascript-object
object-in-javascript
javascript-array
array-in-javascript
1
Answer
0
votes
answered
Oct 19, 2019
by
rajeshsharma
You can define arrays using the array literal as follows −
var x = [];
var y = [1, 2, 3, 4, 5];
Related questions
0
votes
How can you create an Object in JavaScript?
asked
Oct 19, 2019
in
JavaScript
by
SakshiSharma
javascript-object
object-in-javascript
0
votes
What is arguments object in JavaScript?
asked
Oct 19, 2019
in
JavaScript
by
SakshiSharma
javascript-object
object-in-javascript
properties-javascript
0
votes
How can one use JavaScript to create an Array?
asked
Sep 18, 2021
in
JavaScript
by
sharadyadav1986
javascript-array
0
votes
In JavaScript, what is argument object and how can you get argument types passed to a function?
asked
Sep 19, 2021
in
JavaScript
by
sharadyadav1986
javascript-object
0
votes
Which of the following number object function returns the value of the number?
asked
Mar 20, 2021
in
JavaScript
by
sharadyadav1986
object-function
javascript-object
0
votes
Which of the following givenfunctions of the Number Object formats a number with a different number of digits to the right of the decimal?
asked
Mar 20, 2021
in
JavaScript
by
sharadyadav1986
javascript
javascript-object
object-javascript
0
votes
How to create an array in JavaScript?
asked
Jun 9, 2022
in
JavaScript
by
sharadyadav1986
array
javascript
0
votes
In JavaScript, how can you empty an Array?
asked
Sep 21, 2021
in
JavaScript
by
sharadyadav1986
empty-array
0
votes
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();
asked
Feb 6, 2020
in
JavaScript
by
rajeshsharma
#java-script-array
+1
vote
How to add one new element at end of an array in javascript?
asked
Jul 16, 2019
in
JavaScript
by
Indian
#java-script
0
votes
How can you create a cookie with the help of JavaScript?
asked
Sep 19, 2021
in
JavaScript
by
sharadyadav1986
javascript-cookie
+1
vote
How to create an array in js and how to read array elements?
asked
Jul 16, 2019
in
JavaScript
by
Indian
#java-script
+1
vote
How can you move element in lowercase to uppercase from an array?
asked
Jul 16, 2019
in
JavaScript
by
Indian
#java-script
0
votes
Can we create Cookie in Javascript if yes then how to create that?
asked
Aug 24, 2020
in
JavaScript
by
Hodge
#javascript
0
votes
How can you read properties of an Object in JavaScript?
asked
Oct 19, 2019
in
JavaScript
by
SakshiSharma
properties-javascript
javascript-properties
properties-of-javascript
...