3 ms·
JavaScript: generating a function with runtime data from a declared function
- lutusp 13y agoIt's called "regression analysis". Nothing to see here, move along. :)
- sigilworks 13y agoI 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 + ");" ); };