Which of the following is the correct way to declare an array in JavaScript?
- var myArray = [];
- array myArray = [];
- myArray = new Array();
- myArray = {}
The correct way to declare an array in JavaScript is by using square brackets []. So, var myArray = []; is the correct syntax. The other options are either not valid or used in different programming languages.
Loading...
Related Quiz
- In Node.js, '______' is used to signify the end of a writable stream.
- When creating a custom readable stream in Node.js, implementing the '______' method is essential to supply the stream with data chunks.
- You are implementing error handling in an Express application, and you notice that asynchronous errors are not being caught by your error-handling middleware. How should you modify your error-handling approach to ensure that asynchronous errors are caught?
- How can ESLint be configured to automatically fix certain issues when saving files?
- How can you match routes with a specific pattern in Express.js?