美文网首页
基本包装类型

基本包装类型

作者: chenrui92 | 来源:发表于2016-11-29 23:08 被阅读0次

    number类型

    .toFixed(num)   返回string,num指定小数点后位数

    toExponential(num)  返回string,指数表示法,num制定位数

    toPrecision(num) 返回string,示情况调用toFixed和toExponential

    boolean类型

    String类型

    charAt(index)  返回字符

    charCodeAt(index)  返回字符编码

    concat(str)  连接字符串

    slice(begin, end)  返回副本

    substr(begin, len)  返回副本

    substring(begin, end) 返回副本

    indexOf(str, index)  返回位置

    lastIndexOf(str,index)  返回位置,从后往前

    trim()  去除前后的空格  es5

    toLowerCase()  返回全小写

    toUpperCase()  返回全大写

    match(RegExp)  返回匹配的副本

    seach(RegExp)  返回index

    replace(RegExp, str)  返回副本,不修改原字符串

    split(str or RegExp, len)  返回分割后的数组,len为最大长度

    相关文章

      网友评论

          本文标题:基本包装类型

          本文链接:https://www.haomeiwen.com/subject/hlpbpttx.html