标签:document dex cti for console doc span div indexof
function fn(){
console.log(this)
}
document.getElementById("div1").onclick=function(){
fn()
}
document.getElemenById("div1").onclick=fn
var obj={
val=2
abl:function(){
console.log(this)
this.val*=2
console.log(this.val)
}
}
var ff=obj.abl()
var fn=obj.abl:fn()
var a=123;
var b={
"name":"zhang"
}
var c=["ni",23]
var d=function(){
console.log(12)
}
function fn(){
console.log(11)
function ff(){
console.log(22)
}
ff()
}
fn()
fn()
function(){
console.log(12)
}
as()
var as=function(){
console.log(45)
}
var a=12
function fn(){
console.log(a)
var a=45;
console.log(a)
}
fn()
function fn(){
console.log(12)
}
var as=fn()
vonsole.log(as)
function fn(){
console.log(12)
return 45;
console.log(456)
}
var as=fn()
var a=12
function fn(){
console.log(a)
return 4
var a=45
}
fn()
var a=45;
function fn(a)
console.log(a)
}
var a=100;
function testResult(){
var b=2*a;
var a=200;
var c=a/2;
alert(b)
alert(c)
}
testResult()
function fn()
var a=12;
return function(){
a++;
console.log(a)
}
}
var ss= fn()
ss()
ss()
ss()
function fun(n,o) {
console.log(o)
return {
fun:function(m){
// 1,0
return fun(m,n);
}
};
}
var arr=[12,45,12,23,12,23];
var ass=[];
for(var i=0;i<arr.length;i++){
if(ass.indexOf(arr[i])==-1){
ass.push(arr[i])
}
}
console.log(ass)
var a = 123;
function fun(){
alert(a);
}
fun();
var a = 123;
function fun(){
alert(a);
var a = 456;
}
fun();
alert(a); var a = 123;]function fun(){
alert(a);
var a = 456;
}
fun();
alert(a);
console
console.log(this)
function chifan(){
console.log(this)
}
班长.chifan()
window.chifan()
window
var fn=function (){
chifan()
}
fn()
function fn(){
console.log(this)
}
var obj={
fn:fn
}
obj.fn()
var obj={
ff:function(){
this =>obj
console.log(this)
fn() //window
}
}
obj.ff() //obj
function(){console.log(this)}()
var num=45
var obj={
num:12,
ff:(function(){
console.log(this.num)
obj.num
})()
}
obj.ff()
function fn(){
console.log(this)
}
document.getElementById("div1").onclick=function(){
console.log(this) div1
fn() // window
}
document.getElementById("div1").onclick=fn; //div1
var num=56;
var obj={
num:20,
ff:function(){
this 是obj
console.log(this.num)
return function(){
console.log(this.num)
}
}
}
obj.ff()==>function
var dd=obj.ff()//var dd=function(){this.num}
console.log(dd)
dd()
var val=1;
var obj={
val:2,
dbl:function(){
var val=45
console.log(this)// obj
this.val*=2
console.log(val)
console.log(this.val)
}
}
var ff=obj.dbl() //1 4
var fn=obj.dbl;fn()
fn=function(){
console.log(this)// obj
this.val*=2
console.log(val)
console.log(this.val)
}
标签:document dex cti for console doc span div indexof
原文地址:https://www.cnblogs.com/jiaxinchao/p/10054733.html