var x = 10, y = 100; console.log(window.x + ' ' + window.y);
;(function(window){
'use strict';
var x = 10,
y = 100;
console.log(window.x + ' ' + window.y);
}(window));
(function(){
'use strict';
var x = 10,
y = 100,
c,
elem=$('body');
console.log(window.x + ' ' + window.y);
$(document).on('click',function(){
});
if(typeof c==='undefined'){
//你的代码
}
}());
;(function($,window,document,undefined){
'use strict';
var x = 10,
y = 100,
c,
elem=$('body');
console.log(window.x + ' ' + window.y);
$(document).on('click',function(){
});
if(typeof c==='undefined'){
//你的代码
}
}(jQuery,window,document));
'use strict';
(function(){
}());
(function(){
'use strict';
}());
function myFun(){
x=5;
y=10;
}
function myFun(){
var x=5;
var y=10;
}
function myFun(){
var x=5,
y=10;
}
(function(w){
'use strict';
w.console.log('0' == 0); // true
w.console.log('' == false); // true
w.console.log('1' == true); // true
w.console.log(null == undefined); // true
var x = {
valueOf: function() {
return 'X';
}
};
w.console.log(x == 'X');//true
}(window.console.log));
(function(w){
'use strict';
w.console.log('0' === 0); // false
w.console.log('' === false); // false
w.console.log('1' === true); // false
w.console.log(null === undefined); // false
var x = {
valueOf: function() {
return 'X';
}
};
w.console.log(x === 'X');//false
}(window));
if(!x) {
if(!y) {
x = 1;
} else {
x = y;
}
}
x = x || y || 1;
// 1.
MyClass.prototype.myMethod = function() {
return 42;
} //这里没有分号
(function() {
})();
//2.
var x = {
'i': 1,
'j': 2
} // 这里没有分号
//我知道这样的代码你可能永远不会写,但是还是举一个例子
[ffVersion, ieVersion][isIE]();
// 3.
var THINGS_TO_EAT = [apples, oysters, sprayOnCheese] // 这里没有分号
-1 == resultOfOperation() || die();
if (x) {
function foo() {}
}
if (x) {
var foo = function() {};
}
//数组长度3 var a1 = new Array(x1, x2, x3); //数组长度2 var a2 = new Array(x1, x2); //如果x1是一个自然数,那么它的长度将为x1 //如果x1不是一个自然数,那么它的长度将为1 var a3 = new Array(x1); var a4 = new Array();
var a = [x1, x2, x3]; var a2 = [x1, x2]; var a3 = [x1]; var a4 = [];
var o = new Object(); var o2 = new Object(); o2.a = 0; o2.b = 1; o2.c = 2; o2['strange key'] = 3;
var o = {};
var o2 = {
a: 0,
b: 1,
c: 2,
'strange key': 3
};
if(x === 10) {
return 'valid';
} else {
return 'invalid';
}
return x === 10 ? 'valid' : 'invalid';
for(var i=0;i<arr.length,i++){
}
for(var i=0,len=arr.length;i<len,i++){
}
$('.myDiv').find('.span1').text('1');
$('.myDiv').find('.span2').text('2');
$('.myDiv').find('.span3').text('3');
$('.myDiv').find('.span4').text('4');
var mydiv=$('.myDiv');
mydiv.find('.span1').text('1');
mydiv.find('.span2').text('2');
mydiv.find('.span3').text('3');
mydiv.find('.span4').text('4');
$('.myDiv').find('.span1').text('1')
.end().find('.span2').text('2');
.end().find('.span3').text('3');
.end().find('.span4').text('4');
//获取订单
function getOrderByID(id){
var order;
//...
return order;
}
/**
* 根据订单id获取订单详细数据
* @param {[number]} id [订单ID]
* @return {[order]} [订单详细信息]
*/
function getOrderByID(id){
var order;
//...
return order;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有