Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28768
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: new Function() |
| Date | 2015-09-30 21:12 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87h9mb64zp.fsf@bsb.me.uk> (permalink) |
| References | <a52a763b-4769-4ca6-8f82-9785514df782@googlegroups.com> |
Jay Braun <lyngwyst@gmail.com> writes: > I am having some trouble experimenting with 'new Function()' as an > alternative to 'eval()'. OK, but unless this is just a learning exercise, why are you changing code that works for code that does not yet work? Using new Function and then calling the resulting function is not any safer than calling eval, if that is your reason. <snip> > Simple on-line examples of 'new Function()' show the "new" function > being constructed in-line by some JavaScript code. That's not what is > occurring here, and my attempts to apply the examples have failed. Well something is probably wrong with the "new Function" call, but how can anyone possibly help if you don't show the code? > In particular, the browser console indicates that funcName() is not > recognized. This indicates a significant misunderstanding. The result of the new Function call is a function itself -- if it gets a name at all, it will be because you store the result in variable. -- Ben.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
new Function() Jay Braun <lyngwyst@gmail.com> - 2015-09-30 11:28 -0700
Re: new Function() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-30 21:15 +0200
Re: new Function() Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-30 21:12 +0100
Re: new Function() Jay Braun <lyngwyst@gmail.com> - 2015-09-30 20:30 -0700
csiph-web