Question about JS method call brackets

Source: Internet
Author: User

The question of using the JS method to call brackets is a headache. The following is a good example. If you are interested, refer

On the mobile html page, a function is written. the Code is as follows: function showAlert (msg, fn) {showDialog ("alert", msg, "tip", 260); if (isNull (fn) = false) {$ ("# SD_confirm "). unbind ("click"); $ ("# SD_confirm "). bind ("click", fn) ;}} function exist () {alert ("aaa");} fn is a function, during the call, I wrote the copy code as follows: showAlert (json. msg, exist (); when the result reaches this line of code, before the showDialog method is reached, exit exist to bring up aaa. What happened, and then I found that I was wrong. the Code should be written as follows: showAlert (json. msg, exist); then, a prompt for dialog appears, and click OK. The error "aaa. Mei" is displayed. It turns out to be an error in parentheses. Khan!

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.