Professional Javascript 学习笔记 第二章

本文详细介绍了JavaScript中数组的各种方法,包括但不限于如何判断一个对象是否为数组、数组元素的增删改查操作、数组的排序与反转等。同时,还提到了日期对象的一些基本用法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

数组的一些方法: var obj = new Array();

  • Array.isArray(obj)判断是否是数组
  • obj.join(",");返回通过,连接的字符串
  • obj.push(ag1,arg2,...); obj.pop()(取最后一个元素);当做栈使用。
  • obj.unshift(arg1,arg2);obj.shift()(取第一个元素);当队列使用
  • obj.reverse();obj.sort(function compare);反转和排序;
  • obj.concat(arg1,arg2,...);连接
  • obj.slice(beginIndex[,endIndex]);截取
  • obj.splice(beginIndex,itemToDelete,arg1,arg2,...);替换或插入
  • obj.indexOf(arg) obj.lastIndexOf(arg);查找
  • 另外有 obj.every(function(item,index,array)) obj.some(function(item,index,array)) obj.filter(function(item,index,array)) obj.mapfunction(item,index,array)) obj.forEach(function(item,index,array));

Date的一些方法:

  • new Date(); new Date(Date.parse("3/23/2003"));  new Date(Date.UTC(2003,11,30,18,19,20));代表12月20日,date的month从0开始。
  • Date.now();return current miles
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值