A few days ago, when it comes to JS, try not to use eval, but what exactly is eval? Today we're going to talk about the eval thing.
First look at this definition:
Definitions and usage
The eval () function computes a string and executes the
Definition and usage the eval () function computes a string and executes the JavaScript code in it.
The syntax eval (string) argument describes string as required. The string to evaluate, which contains the JAVASCRIPT expression to evaluate or the
The eval usage eval function receives an argument s, and if S is not a string, it returns directly to S. Otherwise execute the S statement, here is an example of eval parsing JSON First of all, the use of eval, the content is relatively simple,
First, the use of eval, the content is relatively simple, familiar can skipThe Eval function receives an argument s, and if S is not a string, it returns directly to S. Otherwise execute the S statement. If the S statement executes the result is a
"JSON (JavaScript Object notation) is a lightweight format for data interchange. It is based on a subset of ECMAScript. Because of its language-independent text format and the use of a family of C-languages, these features make JSON an ideal
I've written an introductory article about JSON, which talks about JSON parsing. As we all know, advanced browsers can use the Json.parse () API to parse a JSON string into JSON data, slightly defective, and we can use the eval () function.
JSON
If you want to learn more about EV
For Al and JSON, refer to the following links:
EVal:https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Global_Functions/Ev Al
JSON:http://www.json.org/
Howthe Ev al function works TheEv al function
This paper analyzes the considerations of JS parsing json using eval in detail. Share to everyone for your reference, specific as follows:
There are generally two ways to parse a JSON string into a JSON data format in JS:
1. One is to use the Eval
There are generally two ways to parse a JSON string into a JSON data format in JS:
1. One is to use the Eval () function.
2. Use function objects to perform return parsing.
Use the Eval function to parse, and use each of the jquery methods to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.