/// The `indexOf()` method returns the index within the calling `String` object of the first occurrence of the specified value, starting the search at `fromIndex`.
/// The `indexOf()` method returns the index within the calling `String` object of the first occurrence
/// of the specified value, starting the search at `fromIndex`.
/// The `lastIndexOf()` method returns the index within the calling `String` object of the last occurrence of the specified value, searching backwards from `fromIndex`.
/// The `lastIndexOf()` method returns the index within the calling `String` object of the last occurrence
/// of the specified value, searching backwards from `fromIndex`.
///
///
/// Returns -1 if the value is not found.
/// Returns `-1` if the value is not found.
///
///
/// More information:
/// More information:
/// - [ECMAScript reference][spec]
/// - [ECMAScript reference][spec]
@ -586,41 +588,30 @@ impl String {
args: &[Value],
args: &[Value],
ctx: &mutInterpreter,
ctx: &mutInterpreter,
)-> ResultValue{
)-> ResultValue{
// First we get it the actual string a private field stored on the object only the engine has access to.
letthis=ctx.require_object_coercible(this)?;
// Then we convert it into a Rust String by wrapping it in from_value
letstring=ctx.to_string(this)?;
letprimitive_val=ctx.to_string(this)?;
// TODO: Should throw TypeError if search_string is regular expression
letsearch_string=ctx.to_string(
args.get(0)
.expect("failed to get argument for String method"),