HP Service Manager javascript array function indexOf

Why when I do this:-

 

var fruits = ["Banana", "Orange", "Apple", "Mango"];
var a = fruits.indexOf("Apple");
print(a);

 

do I get this:-

 

 

this is valid javascript which should return 2