0
点赞
收藏
分享

微信扫一扫

数据结构42-链表indexOf方法实现

LinkList.prototype.get = function (data) {
var current = this.head;
var index = 0;
//开始查找
while (current) {
if (current.data == data) {
return index;
}
current = current.next;
index += 1;
}
return -1;
};



举报

相关推荐

0 条评论