顺序表(js)
function List() {
    this.items = []
    List.prototype.init = function () {
    this.items = []
    }
    List.prototype.clear = function () {
    this.items = []
    }
    List.prototype.isEmpty = function () {
    return this.items.length > 0
    }
    List.prototype.toString = function () {
    return this.items.join(' ')
    }
    List.prototype.length = function () {
    return this.items.length
    }
    List.prototype.insert = function (data) {
    this.items.push(data)
    }
    List.prototype.insertAt = function (data, loc) {
    this.items.splice(loc, 0, data)
    }
    List.prototype.delAt = function (loc) {
    this.items.splice(loc, 1)
    }
    List.prototype.del = function (data) {
    let loc = this.find(data)
    if (loc > -1) {
        this.delAt(loc)
        return true
    } else {
        return false
    }
    }
    List.prototype.updateAt = function (data, loc) {
    this.items[loc] = data
    }
    List.prototype.find = function (data) {
    for (let i = 0; i < this.items.length; i++) {
        if (this.items[i] == data) {
        return i
        }
    }
    return -1
    }
    List.prototype.findAt = function (loc) {
    return this.items[loc]
    }        
}
链式表(js)
function LinkedList() {
    function Node(data) {
    this.data = data;
    this.next = null;
    }
    this.head = null;
    this.len = 0;

    LinkedList.prototype.append = function (data) {
    let node = new Node(data)
    if (this.len) {
        let cur = this.head;
        while (cur.next) {
        cur = cur.next;
        }
        cur.next = node
    } else {
        this.head = node;
    }
    this.len += 1;
    }
    LinkedList.prototype.insert = function (ind, data) {
    if (ind < 0 || ind > this.len) {
        console.log('ind overflow, insert fail');
        return false;
    } else {
        let node = new Node(data)
        if (!ind) {
        node.next = this.head
        this.head = node
        } else {
        let cur = this.head
        for (let i = 0; i < ind - 1; i++) {
            cur = cur.next
        }
        node.next = cur.next
        cur.next = node
        }
        this.len += 1
        return true
    }
    }

    LinkedList.prototype.indexOf = function (data) {
    let ind = 0
    let cur = this.head
    while (cur) {
        if (cur.data == data) {
        console.log(`item ${data} found at ${ind}`);
        return ind
        }
        ind++
        cur = cur.next
    }
    console.log(`item ${data} not found`);
    return false
    }

    LinkedList.prototype.getItemAt = function (ind) {
    if (ind < 0 || ind > this.len - 1) {
        console.log('ind overflow, item get fail');
        return false;
    } else {
        let cur = this.head
        for (let i = 0; i < ind; i++) {
        cur = cur.next
        }
        console.log('data at ', ind, 'found:', cur.data);
        return cur.data
    }
    }

    LinkedList.prototype.delItemAt = function (ind) {
    if (ind < 0 || ind > this.len) {
        console.log('ind overflow, delete fail');
        return false;
    } else {
        if (!ind) {
        this.head = this.head.next
        } else {
        let cur = this.head
        for (let i = 0; i < ind - 1; i++) {
            cur = cur.next
        }
        cur.next = cur.next.next
        }
        this.len -= 1
        console.log(`item at index ${ind} deleted`);
        return true
    }
    }

    LinkedList.prototype.del = function (data) {
    let ind = this.indexOf(data)
    if (ind) {
        this.delItemAt(ind)
    } else {
        console.log(`item ${data} not found`);
        return false
    }
    }

    LinkedList.prototype.toString = function () {
    let cur = this.head
    let str = ''
    while (cur) {
        str += cur.data + ' ';
        cur = cur.next
    }
    console.log(this.len + ' item(s):', str);
    return str
    }
}