Select the name of the String method that returns the position of first occurrence of a specified value in a string.
Explanation
The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present. Example:

var a = 'myString';
var b = a.indexOf('Str');
console.log(b) // 2

var c = a.indexOf('str');
console.log(c) // -1 , because JS case sensitive

@iliana000, fixed. It was translation error.

2016 Jan 20, 5:53:30 PM

Why position() is one of the right answers?? This method doesn't even exist in JavaScript, does it?

2016 Jan 15, 7:17:55 AM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes