ObservableArray.reduce doesn't work like regular array.reduce


See playground here (the only code I changed is in home.component.ts): https://play.nativescript.org/?template=play-ng&id=iRu1Lq&v=4

The reduce function works great on a regular array, but it throws an error when I do the exact same thing with an ObservableArray. Am I doing something wrong?


Set initial value like this,

let maxObsArrayMetric: number = myObsArray.reduce(function (prev, current) {
            return (prev.metric > current.metric) ? prev : current;
        }, myObsArray.getItem(0)).metric;

But of course it looks like a bug when not setting initial value. You may submit a issue in Github repo.