fold issues with ES5
nogo10 opened this issue · comments
As shown on stackoverflow question
ES6 arrow function " => " works fine with observable.fold(seed, f)
const stream = Bacon.sequentially(100, ["Hello", "world"])
stream.log("stream")
const concatenated = stream.fold("", (a,b) => a + b)
concatenated.log("concatenated")
However in strict ES5 syntax:
var stream = Bacon.sequentially(100, ["Hello", "world"]);
stream.log("stream");
var concatenated = stream.fold("", function (a,b){ a + b});
it doesn't work results in 'undefined' value on console
You're missing a return
statement :)
Because you've missed a return.
const concatenated = stream.fold("", (a,b) => a + b)
In es5 is actually
var concatenated = stream.fold("", function (a,b){ return a + b});
On Thu, 30 Jun 2016 4:42 pm Juha Paananen notifications@github.com wrote:
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#669 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABEGa8wl9YP9IuipqDLCo4CHLlwbmKtsks5qQ2VMgaJpZM4JBwHK
.
Sorry... Slow to the thread.
On Thu, 30 Jun 2016 5:39 pm Darren Nolan me@darrennolan.com wrote:
Because you've missed a return.
const concatenated = stream.fold("", (a,b) => a + b)
In es5 is actually
var concatenated = stream.fold("", function (a,b){ return a + b});
On Thu, 30 Jun 2016 4:42 pm Juha Paananen notifications@github.com
wrote:—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#669 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABEGa8wl9YP9IuipqDLCo4CHLlwbmKtsks5qQ2VMgaJpZM4JBwHK
.
Ok -thanks- solved for me ..im the slow one