Browse Source

Chore(listed): Add a hint for the third instruction and clarify the first

pull/2760/head
Oumaima Fisaoui 4 weeks ago
parent
commit
c4a427c457
  1. 10
      subjects/AI.GO/listed/README.md

10
subjects/AI.GO/listed/README.md

@ -42,7 +42,7 @@ let batteryLevels = [80, 60, 90, 50];
### Indexes in Arrays ### Indexes in Arrays
The position of an element in an array is called its index, starting from 0. So, our `batteryLevels` array is roughly equivalent to writing this object: The position of an element in an array is called its `index`, starting from `0`. So, our `batteryLevels` array is roughly equivalent to writing this object:
```js ```js
let batteryLevelsObject = { let batteryLevelsObject = {
@ -109,7 +109,7 @@ Now, the array looks like this:
#### Task 1: #### Task 1:
You must declare a variable `components` that contains 4 strings, one for each robot component "motor", "sensor", "battery" and "camera" (respect that order). You must declare a variable `components` that contains 4 strings, one for each robot component : `"motor"`, `"sensor"`, `"battery"` and `"camera"` (respect that order).
#### Task 2: #### Task 2:
@ -128,7 +128,7 @@ We provide you a variable `robotParts` that contains some elements. You will hav
#### Task 3: #### Task 3:
You must replace the third element of the provided `replaceComponents` array with the string 'enhanced'. - You must replace the third element of the provided `replaceComponents` array with the string 'enhanced'.
Example: Example:
@ -137,7 +137,9 @@ let replaceComponents = ["motor", "sensor", "battery"];
// expect -> ['motor', 'sensor', 'enhanced'] // expect -> ['motor', 'sensor', 'enhanced']
``` ```
You must swap the first and second element of the provided `swapComponents` array. - You must `swap` the first and second element of the provided `swapComponents` array using a variable `temp`.
_Hint: Use a `temp` variable to store the first element, assign the second element to the first, and then assign `temp` to the second element to complete the swap._
Example: Example:

Loading…
Cancel
Save