public int IndexOf(JsValue valueToFind, int?startIndex = null) { var args = new List <JsValue> { valueToFind }; if (startIndex.HasValue == true) { args.Add(ValueFactory.CreateNumber(startIndex.Value)); } var fn = GetProperty <JsFunction>("indexOf"); var result = fn.Call <JsNumber>(this, args.ToArray()); return(result.ToInt32()); }
public JsNumber CreateNumber(int number) { return(ValueFactory.CreateNumber(number)); }