let me modify some of these things 
2 Likes
ok Ill wait here 
hey, but put return index; in which two {}
3 Likes
get rid of return Index and put the return -1;
here
1 Like
so basically move the return -1
2 lines down in between } }
1 Like
Oh, okay, ill do that now
3 Likes
I just had to reload the level, but it creates an infinite loop
3 Likes
can you post your code then?
1 Like
yea sure, here it is:
// You must to find the treasure.
// This function should return the index of a letter:
function letterIndex(word, letter) {
// Step through each letter as an index of the word.
for(var i=0; i<word.length; 1){
// Store a character from the word with the current index.
var currentIndex= letterIndex[i];
// If it is the required letter:
if (currentIndex==letter){
return i
}
// Then return the current index (number).
// If nothing, return a default value
}
return -1;
}
var ogreLetter = "z";
var shaman = hero.findByType("thoktar")[0];
// Find the index and use it for finding the treasure.
var chestIndex = letterIndex(shaman.id, ogreLetter);
hero.moveXY(16 + chestIndex * 8, 36);
3 Likes
ummm change that 1 to i++
1 Like
did you change the one to i++?
1 Like
Yes, it still does the same thing
3 Likes
ok give me a sec…
1 Like
@Lydia_Song I saw you replying do you want to say something?
3 Likes
No, I just needed to paste something
Lydia
2 Likes
change the letterIndex to word[i]
2 Likes
Oh, sorry. I just saw on your profile that you only code python
3 Likes
AYYY thank you so much @Falcons118 it worked! you are the best
3 Likes
anytime dude 
congratulations on passing

2 Likes
