intermediate javascript: assign a function with its parameter to a variable and execute later
来源:互联网 发布:linux lpctstr 编辑:程序博客网 时间:2024/06/05 04:48
http://stackoverflow.com/a/7776322
I have a function in javascript:
function alertMe($a){ alert($a);}
Which I can execute like this: alertMe("Hello");
I want to do is assign alertMe("Hello") with the "Hello" parameter to a variable $func,and be able to execute this later by doing something like $func();
I would like to add the comment as answer
Code
//define the functionfunction alertMe(a) { //return the wrapped function return function () { alert(a); }}//declare the variablevar z = alertMe("Hello");//invoke nowz();
0 0
- intermediate javascript: assign a function with its parameter to a variable and execute later
- Tensorflow ValueError: Attempt to reuse RNNCell with a different variable scope than its first
- Attempt to execute SCRIPT *** as a function
- Attempt to execute SCRIPT ** as a function
- Call to a member function assign() on a non-object
- How to write a function which has variable args and can be wrapper?
- execute a Javascript function in a Webbrowser/ IE Document?
- Setting a Javascript variable to undefined
- more safe way to assign a property value of an object to a variable
- Call to a member function assign() on null
- static member variable and static member function in a class
- How to execute a method (procedure/function) by name
- dotproject的Call to a member function Execute() 解决办法
- Attempt to execute SCRIPT plot as a function?
- Matlab Attempt to execute SCRIPT*as a function解决方法
- 解决Attempt to execute SCRIPT mexLasso as a function
- Matlab Attempt to execute SCRIPT * as a function解决方法
- [Matlab] Attempt to execute SCRIPT *** as a function
- 大数据时代:搭建自己的大数据平台可以很容易!
- CODIS使用文档
- 透明导航栏
- Qt给自己写的程序加上图标
- 玩转Google新开源项目:FlexboxLayout
- intermediate javascript: assign a function with its parameter to a variable and execute later
- Android 学习
- 序列化和反序列化
- LeetCode 298. Binary Tree Longest Consecutive Sequence
- Android的Jack编译器试用
- 打开蓝牙和关闭蓝牙
- SQL行转列汇总
- 优化Hadoop Balancer运行速度
- SIM卡中UCS2编码的三种格式(80,81,82)分析