0
What is []?
Array is confusing for me. But what is [] for?
4 Respuestas
+ 1
It's an empty array. I suppose you're learning Javascript, so:
You're normally assigning this to a variable like:
"let languages = []"
Arrays are lists of items with specific functions, like "push" which adds specific item to the end, so whe can have a block of code:
"let languages = [] // Lets the code know that it's an array
function addLanguage(language) {
languages.push(language)
}
if you wouldn't write the = [], it would think it's typeof undefined and the code would produce an error
+ 2
Please use the language tag next time.
+ 1
Check this, may help ...
http://www.scriptingmaster.com/javascript/operator-precedence.asp
0
https://www.sololearn.com/discuss/2479168/?ref=app
https://www.sololearn.com/discuss/2477129/?ref=app
https://www.sololearn.com/discuss/2465833/?ref=app
https://www.sololearn.com/discuss/2481354/?ref=app