博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Js Pattern - Self Define Function
阅读量:6917 次
发布时间:2019-06-27

本文共 556 字,大约阅读时间需要 1 分钟。

This pattern is useful when your function has some initial preparatory work to do and

it needs to do it only once.In such cases, the selfdefining function can update its own implementation.

eg:

var selfFunc = function () {        console.log("First Initialization!");        selfFunc = function () {            console.log("-- Function Logic --");        };    };    window.onload = function () {        selfFunc();        selfFunc();        selfFunc();        console.log("
"); };

 

Result:

First Initialization!
-- Function Logic --
-- Function Logic --

 

 

转载地址:http://qgxcl.baihongyu.com/

你可能感兴趣的文章
关于XIFF开发IM的一些想法
查看>>
web设计经验<五>国外设计师总结的7个找灵感实用方法
查看>>
ForkJoinPoolet用于类似递归
查看>>
31. Ubuntu15.04系统中如何启用、禁用客人会话
查看>>
C# this关键字(给底层类库扩展成员方法)
查看>>
loadrunner11安装教程
查看>>
JMeter安装教程
查看>>
给学习IT、编程者的看
查看>>
c语言学习
查看>>
重装系统
查看>>
Kinect For Windows V2开发日志八:侦测、追踪人体骨架
查看>>
会计的思考(36):会计--企业运营的数码相机
查看>>
最近学习总结
查看>>
JSP页面获取其他页面传递的参数
查看>>
Call Transaction 小节
查看>>
[CALayer release]: message sent to deallocated instance iOS内存过度释放问题
查看>>
EF6+Sqlite连接字符串的动态设置
查看>>
linux下安装python3.7
查看>>
JS正则
查看>>
RTSP详解
查看>>