I can not pass the level. second gem


#1
// One gem is safe, in others there are bombs.
// But you know the rule: always take the second.
while (true) {
    var items = hero.findItems();
// If the length of the array is greater than or equal to 2:
 items;
if (items.length >= 2) {
// Move to the second object of the array.
//????? help.
// Else.
 } else {
// Move to the center.
hero.moveXY(40, 34);
}
}

#2

What is an array?
an array is a table of elements

Let’s say you want to make an array of items and you know already the number of elements there will be in it:

var array = [item1, item2];

you know that there is only 2 items in the array.
How are you going to select the item #2 in array?

hero.say(array[1])
so you have to write the name of the array and the index.

why [1] and not [2]? indexation always start at 0 in javascript or Python
(not True to all programming languages though)

what does hero.findNearestItem()?
it create and object with pos attributes.

what does
var items = hero.findItems();?
it creates an array of objects with pos attributes!