一.字符串对象
.length 获取数组长度
[] 下标 从0开始,不管是文字还是标点符号在字符串里面都占一个位置
//如果在引号里面加引号,外单内双,内双外单
indexOf 数组去重: 1.查找字符串
2.如果当前字符串中存在该字符那么返回该字符的下标
3.如果当前字符串中不存在的该字符那么返回的是-1
4.如果不止一个字符也就是在多个情况下,返回的是从左往右数最近的那一个字符的小标
lastindexOf: 1.查找字符串 2.不存在的该字符那么返回的是-1,如果存在它查找的是从右往左进行查找
注意:下标的顺序永远不会发生改变
match:查找字符串 1.如果该字符存在会返回一个数组,里面包含找到的该字符,该字符的下标,整个字符串都会被返回
replace: 替换内容 (第一个是要被替换字符,要替换成什么字符)
toUpperCase() 英文转大写
toLowerCase 英文转小写
// toString 将number类型转换为string类型2.转换进制
var num = 123.389;
console.log( typeof num.toString());
console.log( num.toString(2));
// Number () 将任意类型转换为number类型
var bool = true;
console.log(Number(bool));
// split 1.将字符串转为数组2.分割字符串然后回复相应的数组内容(看自己当前数据具备用什么符号进行分割)
console.log(str.split(","));
二.Math
// Math Math.ceil() 永远前一位进 1.向上舍入
// Math.floor() 向下舍入 2.搭配随机数使用
// Math.round() 四舍五入
三.Date
var time = new Date();
年: console.log(time.getFullYear());
月: console.log(time.getMonth());
日: console.log(time.getDate());
时: console.log(time.getHours());
分: console.log(time.getMinutes());
秒: console.log(time.getSeconds());
正则表达式: test