I study javascript. In the tutorial, here is an example:
var str = "Widget with id"; alert( str.indexOf("Widget") ); // 0, т.к. "Widget" найден прямо в начале str alert( str.indexOf("id") ); // 1, т.к. "id" найден, начиная с позиции 1 alert( str.indexOf("widget") ); // -1, не найдено, так как поиск учитывает регистр Why in 2 cases 1 and not 2 ? This is the 3rd element.