标是从0开始的,不管是文字还是标点还是特殊符号在字符串
里面都各占一个字符
indexof---数组去重
1.作用就是查找字符串
* 2.如果当前字符串中存在该字符那么返回的是该字符的下标
* 3.如果当前字符串中不存在该字符那么返回的是-1
* 4.如果有不止一个字符也就是存在的多个情况下,返回的是从
* 左往右数最近的那一个字符的下标
console.log(str.indexOf("静"));
// lastIndexOf 查找字符串 不存在的情况下返回-1,如果存在他查找
//的顺序是从右往左进行查找的
// 注意:下标永远都不会被改变顺序都是从左往右
console.log(str.lastIndexOf("静"));
// match 查找字符串
// 1.如果该字符在字符串中存在会返回一个数组,里面包含找到的该字符串
//,该字符串下标,整个字符串都会被返回
console.log(str.match("超"));
// replace替换内容(第一个是要被替换字符,要替换成什么字符)
console.log(str.replace("静","艺"));
// toUpperCase英文转大写
console.log(str.toUpperCase());
// toLowerCase英文转小写
console.log(str.toLowerCase());
// toString将number类型转换为string类型2.转换进制
var num = 123.456;
console.log(num.toString(2));
//Number()将任意类型转换为number类型
var sss= true
console.log(Number(sss));
//split 1.将字符串转为数组2.分割字符串然后回复相应的数组内容(看自己当前数据具体用什么符号进行分割)
console.log(ss.split(","));
//js中的字符串是不可变的,所有不管使用什么字符串里面自带的方法度不会改变原有字符串
//Math.ceil()永远前一位进1,向上舍入
//Math.floor()向下舍入2.搭配随机数使用
//Math.round()四舍五入
var ssss=12.36
console.log(Math.ceil(ssss));
console.log(Math.floor(ssss));
console.log(Math.round(ssss));
//Date
var num = new Date;
console.log(num);
console.log(num.getFullYear());
console.log(num.getMonth());
console.log(num.getDate());
console.log(num.getHours());
console.log(num.getMinutes());
console.log(num.getSeconds());