Brute
March 20, 2024, 10:27am
1
Tell us what’s happening:
The second test for this challenge does not test what is stated.
There are 2 tests:
The variable myData should equal the first value of myArray.
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
Learn to Code — For Free
Teller
March 20, 2024, 10:29am
2
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
Brute
March 20, 2024, 10:31am
3
Yes, sure, I understand the correct answer. My issue is that test 2 is not testing what is being stated it does.
Teller
March 20, 2024, 10:37am
4
The tests are checking for a specific variable name.
Brute
March 20, 2024, 10:38am
5
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]
Teller
March 20, 2024, 10:58am
6
The second test is checking for bracket notation.
Brute
March 20, 2024, 11:00am
7
I’m sorry, I typed the wrong case. I meant to write: const xxx = myArray[1]
ILM
March 20, 2024, 2:02pm
8
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
Brute
March 20, 2024, 3:05pm
9
Alright thanks for the info, will create a PR.
system
Closed
September 19, 2024, 3:05am
10
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.