Basic JavaScript - Access Array Data with Indexes, wrong tests

Tell us what’s happening:

The second test for this challenge does not test what is stated.
There are 2 tests:

  1. The variable myData should equal the first value of myArray.

  2. The data in variable myArray should be accessed using bracket notation.

Expected behavior:

  • const myData = myArray[0] - No tests fail
  • const myData = myArray[1] - Test 1 fails
  • const xxx = myArray[0] - Test 1 fails
  • const xxx = myArray[1] - Test 1 fails

Current behaviour:

  • const myData = myArray[0] - No tests fail
  • const myData = myArray[1] - Test 1 & 2 fails
  • const xxx = myArray[0] - Test 1 fails
  • const xxx = myArray[1] - Test 1 & 2 fails

i.e. test 2 fails even though the data was accessed using bracket notation.

Your code so far

Not relevant to topic.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0

Challenge Information:

Basic JavaScript - Access Array Data with Indexes

Welcome to the forum @Brute

Like strings, arrays use zero-based indexing, so the first element in an array has an index of 0 .

Happy coding

Yes, sure, I understand the correct answer. My issue is that test 2 is not testing what is being stated it does.

The tests are checking for a specific variable name.

Do you know that or are you just guessing? Then why does not const xxx = myArray[0] fail test 2?

edit: it should be const xxx = myArray[1]

image

The second test is checking for bracket notation.

I’m sorry, I typed the wrong case. I meant to write: const xxx = myArray[1]

if you want to propose a change to the tests, you can open a PR for that, the legacy curriculum is not maintained anymore by staff. You can also open an issue if a PR is too much for you

Alright thanks for the info, will create a PR.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.