js特殊函數

callback  

function a(callback){
alert("这是first函数a");
var x =1;
var y=2;
return callback(x,y);
}
function b(x,y){
alert("这是回调函数b");
return x+y;
}
$(function(){
var result = a(b);
alert("result = "+ result);
});

输出结果为:

这是first函数a

这是回调函数b

result = 3

这里函数首先执行了first函数a,之后调用了回调函数b,最后返回函数a的返回值

!$

 

function checkJquery() {
if (!$) {
return false;
} else return true;
}

 !$ 代表的是上一条命令是否成功执行的结果,true代表执行成功,false代表执行失败

<tr data-index="16">

 

currentClickRowIndex = currentClickRow.data("index");

经测试item.data('index')可以取到索引
   
posted on 2020-09-22 14:37  肉松蛋卷  阅读(106)  评论(0编辑  收藏  举报