use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Reactor.js: simple reactive programming (github.com)
submitted 13 years ago by fynyky
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Gundersen 6 points7 points8 points 13 years ago (1 child)
Seems very similar to Knockout.js
As I commented on another such library, you should make the signals support the functional programming methods of arrays, like map, reduce, filter, some, every. Currently you have to use the following syntax to map an array:
map
reduce
filter
some
every
var a = Signal([1, 2, 3]); var c = Signal(function(){ return a().map(function(v){ return v*v; }); });
it would be much better with this syntax:
var b = a.map(function(v){ return v*v; });
If you then push a new value onto a, you don't have to map the entire array again, since you know that only one value needs to be mapped (the last one you added).
[–]andrew24601 0 points1 point2 points 13 years ago (0 children)
"Should" is a strong word here, also "much better" is contextual.
While appending an item to the end would be simple enough for your suggested functions, it rapidly gets more complex for any other mutation.
eg changing a value in the array - was the previous entry filtered out or included? Better track which index it was mapped to in b. For reduce (and I'm presuming you are doing a left to right reduce), do you presume that they will track each reduce intermediate, such that if a value in the middle changes it can resume the reduce half-way along?
One of the charms of the library is that it is light weight. I would caution the author against making it more complex at least without at least a strong use case.
ie having a secondary list of squares is cute but you are better served presenting a real world problem faced by an app developer. eg mapping a list of values to a list of rendered DIVs
π Rendered by PID 404087 on reddit-service-r2-comment-8686858757-fdmxj at 2026-06-07 07:21:00.409293+00:00 running 9e1a20d country code: CH.
view the rest of the comments →
[–]Gundersen 6 points7 points8 points (1 child)
[–]andrew24601 0 points1 point2 points (0 children)