Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 01-15-2011, 03:12 PM eval evil?
jim1228's Avatar
Extreme Talker

Posts: 195
Name: Jim
Location: Ohio
Trades: 0
I have read that you should not use it. Why?

For example,

Code:
<script>
	var aString = 'var a = {"json" : [{"numeric": 2, "string": "blah"}]};var i = 0;';
	eval(aString);
	alert(a.json[0].numeric);
</script>
jim1228 is offline
Reply With Quote
View Public Profile Visit jim1228's homepage!
 
 
Register now for full access!
Old 01-15-2011, 03:15 PM Re: eval evil?
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Usually there's a better, "cleaner" way to accomplish things than using an eval, but I don't believe the rhetoric eval=evil. It's a useful feature when used properly, and the example you gave is a good one where it's used conveniently.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to eval evil?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25969 seconds with 12 queries