SoloLearn quiz?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 8

SoloLearn quiz??

Let arr = arr[1,2,3,4]; alert(arr[arr[1]); To find the index you count from zero... but the answer is 3, why???šŸ¤”šŸ¤”šŸ¤”šŸ¤”

30th Jun 2019, 4:50 PM
KaešŸ™ŒšŸ½ā˜•ļø
KaešŸ™ŒšŸ½ā˜•ļø - avatar
4 Respostas
+ 6
arr[1] is the second element of the array, so it will be 2. arr[2] will be this third element, so it will be 3
30th Jun 2019, 4:55 PM
Airree
Airree - avatar
+ 6
Airree exactly what i got, but when i ran the code through the console it gave me 3šŸ˜³
30th Jun 2019, 6:37 PM
KaešŸ™ŒšŸ½ā˜•ļø
KaešŸ™ŒšŸ½ā˜•ļø - avatar
+ 6
Airree the arr[arr[1]]. i wonder the first arr[], automatically takes 0 position as the starting position that does make sense and then when the next arr is nested marks the ending position - arr[arr[1]] ... doea not make sense ..... but thats alot for helping me work this out šŸ˜ŠšŸ˜Š
30th Jun 2019, 6:42 PM
KaešŸ™ŒšŸ½ā˜•ļø
KaešŸ™ŒšŸ½ā˜•ļø - avatar
+ 3
Yeah, the result is 3
30th Jun 2019, 6:37 PM
Airree
Airree - avatar