js 函数的几种写法
来源:互联网 发布:jackson转换json 编辑:程序博客网 时间:2024/06/06 05:08
常见写法:
function Test(){
alert("test");
}
调用:Test()
匿名函数:
var test=function(){
alert("test");
}
调用:test();
写法3:
(function () {
alert('test');
})();
写法4:
var Test = {
test1:function(){
alert('test1');
}
,test2:function(){
alert('test2');
}
}
使用:var t = Test.test1();
写法5:
var Test = function(){};
Test.prototype={
test1:function(){
alert('test1');
}
,test2:function(){
alert('test2');
}
}
使用:var t = new Test();
t.test2();
function Test(){
alert("test");
}
调用:Test()
匿名函数:
var test=function(){
alert("test");
}
调用:test();
写法3:
(function () {
alert('test');
})();
写法4:
var Test = {
test1:function(){
alert('test1');
}
,test2:function(){
alert('test2');
}
}
使用:var t = Test.test1();
写法5:
var Test = function(){};
Test.prototype={
test1:function(){
alert('test1');
}
,test2:function(){
alert('test2');
}
}
使用:var t = new Test();
t.test2();
0 0
- js函数的几种写法
- js函数的几种写法
- js函数的几种写法
- js函数的几种写法
- js 函数的几种写法
- [javascript]js函数的几种写法 闭包概要
- js中匿名函数的几种写法
- JS的几种写法
- js函数的几种写法,闭包函数的写法
- JS产生随机数的几种写法
- js定义对象的几种写法
- 关于js的几种写法
- js定时器的几种写法
- js 对象的几种写法
- SWAP函数的几种写法
- SWAP函数的几种写法
- 【转】SWAP函数的几种写法
- swap函数的几种写法
- Android RecyclerView 你不知道的用法
- 使用nginx发布网站
- Android程序在非Debugger状态下运行出现waiting for Debugger?
- iOS - cocoapods的安装与使用
- MYSQL使用UTF8中文乱码终极解决办法
- js 函数的几种写法
- 友盟分享遇到的问题iphone5
- Java NIO:浅析I/O模型
- Fragment中使用startActivityForResult
- 《ArcGIS Runtime SDK for .NET开发笔记》--在线编辑
- c语言宏定义#define的理解与资料整理
- jfinal前端前台传json后台接收
- 内存映射函数
- iOS屏幕截取,截屏办法