Anyone know what happens when you call a function with double ()

任何人都知道用double()调用函数时会发生什么

so

get_separate_save_methods_function(url, false);

becomes

get_separate_save_methods_function(url, false)(); 

I've never seen this before but it seems to change the false argument to true, when you remove the extra () the same argument becomes false. It's not my code and I'm just trying to work out if this is a mistake or has been done of purpose.

我以前从未见过这个,但它似乎将false参数更改为true,当你删除extra()时,相同的参数变为false。这不是我的代码,我只是想弄清楚,如果这是一个错误或已经完成了目的。

2 个解决方案

#1


5

No, () doesn't change the argument from false to true.

不,()不会将参数从false更改为true。

get_separate_save_methods_function(url, false)();

can be used when

可以用的时候

get_separate_save_methods_function(url, false)

returns a function. It calls this returned function.

返回一个函数。它调用此返回的函数。

Given the get_separate_save_methods_function name, this is probably not a mistake but it's hard to tell more with just this code.

给定get_separate_save_methods_function名称,这可能不是一个错误,但很难用这个代码告诉更多。

更多相关文章

  1. Objective-C方法/函数调用。 (来自javascript示例)
  2. Javascript函数的4种调用方法详解
  3. JavaScript(ES5)使用保留字作函数名
  4. 将JavaScript函数的值插入SQL Server数据库
  5. 我可以在JavaScript中从不同的页面传递参数吗?
  6. 轮播图---可以动态添加图片,(封装成一个函数)
  7. javascript高阶函数map和reduce
  8. jQuery插件:如何将元素引用传递给回调函数?
  9. Javascript等待函数的结束,包括node.js的异步MYSQL查询?

随机推荐

  1. Node.js为什么需要C++扩展?
  2. 第4年
  3. 揭秘 Node.js 底层架构
  4. 详解Node模块加载机制
  5. golang 发送post请求 其body中json对象使
  6. 秘籍:自学后端知识体系
  7. python入门教程12-02 (python语法入门之多
  8. android MediaPlayer深入分析
  9. ITIL 4:服务目录管理
  10. 年末最新整理:阿里、腾讯、字节、华为、百