js对象

js的所有东西都是一个对象,包括有他们的方法和属性等等。

我们还可以自定义一些对象

people=new Object();

或者

people={name:" lr",age:"12"};

或者使用函数来创建

function People(name,age){}  

son= new People("lr",12);

1,字符串对象

length

indexOf()

match()  内容匹配

replace()

2,日期对象

var date=new Date(); 直接打印出来就是当前的时间

3,Array

concat()合并数组

sort()       a.sort(sunction(a,b{return a-b;}));   或者b-a表示升序和倒序

push 追加在末尾

reverse 数组整体都翻转

4,Math

round() 四舍五入  Math.round

random() 0-1的随机数

parseInt() 转为int

abs()

原文地址:https://www.cnblogs.com/Coder-Pig/p/5904235.html