Hacker News new | comments | show | ask | jobs | submit login
JavaScript: generating a function with runtime data from a declared function (tsenkov.net)
1 point by tsenkov 1286 days ago | hide | past | web | 4 comments | favorite



I think there are some errors in the final solution code, as it doesn't do what you describe.

Were you aiming at something like this?

var generated = function(value) { return new Function( "return (" + function(valueToSwap) { return { prop: valueToSwap }; } + ")(" + value + ");" ); };


It's called "regression analysis". Nothing to see here, move along. :)


I don't get it, what is?


Using a data set to create a function able to produce that data set.

http://en.wikipedia.org/wiki/Regression_analysis




Applications are open for YC Winter 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: