使用JavaScript实现Java的List功能(实例讲解)

pkunkfeifei 14 0 PDF 2020-12-13 07:12:44

代码如下:/** * js模拟java中的List */ var list = new Array(); /** * 添加 * @param {Object} object */function add(object) { list[list.length] = object;} /** * 移除此列表中指定位置上的元素。 * @param index 指定位置 * @return 此位置的元素 */function removeIndex(index) { var object = this.list[index]; this.list.splice(index, 1); retur

用户评论
请输入评论内容
评分:
暂无评论