{
Value self = ctx->thisObject;
if (ArrayObject *instance = self.asArrayObject()) {
- Q_UNIMPLEMENTED();
+ Value callback = ctx->argument(0);
+ if (callback.isFunctionObject()) {
+ Value thisArg = ctx->argument(1);
+ bool ok = false;
+ for (uint k = 0; !ok && k < instance->value.size(); ++k) {
+ Value args[3];
+ args[0] = instance->value.at(k);
+ args[1] = Value::fromNumber(k);
+ args[2] = ctx->thisObject;
+ Value r;
+ __qmljs_call_value(ctx, &r, &thisArg, &callback, args, 3);
+ ok = __qmljs_to_boolean(ctx, &r);
+ }
+ ctx->result = Value::fromBoolean(ok);
+ } else {
+ assert(!"type error");
+ }
} else {
assert(!"generic implementation");
}
[10,20,30].forEach(function (v,k,o) { print(v,k,o); });
print([10, 20, 30].every(function (v,k,o) { return v > 9 }));
-
+print([10, 20, 30].some(function (v,k,o) { return v == 20 }));