1.
js常见的内置对象
字符串对象,Math对象,Date对象,数组对象
2. 常见的字符串及用法
var str="abaasdffggghhjjkkgfddsssss3444343"
获取字符串的长度
console.log(str.length)
取出指定位置的字符,如9
console.log(str.charAt(9))
查找指定字符是否在以上字符串中存在,如i
console.log(str.indexOf("i"))
替换指定的字符,如g替换为9等操作方法
console.log(str.replace("g",9))
截取指定开始位置到结束位置的字符串,如取得1-5的字符串
console.log(str.substring(1,5))
找出以上字符串中出现次数最多的字符和出现的次数
常见用法
方法(参数列表)/属性
lengtir返回字符串长度
charAt(num)返回参数num指定索引处的字符
charCodeAt(num)返回参数num指定索引处的字符的Unicode值
indexOf(string[.num])返回参数string在字符串中首次出现的位置
lastIndexOf(string(.num])返回参数string在宇符串中最后出现的位置
substring (index1 [index2])返回字符串中index1和index2之问的字符串
substr(index1 [,num])返回宇符串中index1之后的num个宇符
toUpperCase返回字符串大写形式
toLowerCase)返回字符串小写形式
split(reg,num)根据参数传入的正则表达式或者字符(串),将宇符
串替换为新字符串
replace(reg,string)返回参数string出现的位置
search(string)