Thread: Functions
View Single Post
  #2 (permalink)  
Old July 7th, 2006, 12:39 PM
nzakas's Avatar
nzakas nzakas is offline
Wrox Author
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts

They two are roughly equivalent, but using new Function() causes the JavaScript interpreter to invoke another JavaScript interpreter to interpret the text you have passed in. Generally, the second method is frowned upon for this reason.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)