JS eval () function

Source: Internet
Author: User

Jseval () function
This function can treat a string as aJavascriptExpression to execute it.
For a small example:
//Executing an expression
var the_unevaled_answer = "2 + 3";
var the_evaled_answer = eval ("2 + 3");
Alert ("The un-evaled answer is" + The_unevaled_answer + "and the evaled answer are" + the_evaled_answer);

If you run this sectionEvalProgram,You will see inJavascriptString in"2 + 3"was actually carried out.
So when you putThe_evaled_answerValue is set toEval ("2 + 3")WhenJavascriptWill understand and put23the_evaled_ Answer
/span>

  reference article http:/ blog.csdn.net/huangboxi/article/details/4983828

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.