zoukankan      html  css  js  c++  java
  • 学习记录-1

    类型检测:typeof
            
                       typeof 100   typeof NaN       //"number"
                       typeof true        //"boolean"
                       typeof function       //"function"
                       typeof(undefined)      //"undefined"
                       typeof new Object()  typeof [1,3]  typeof null  //"object"

        
             instanceof  //实例检测,检测到原型链上
            
                [1,3] instanceof Array   // true
                [1,3] instanceof String  // false
            
        
             Object.prototype.toString
            
                Object.prototype.toString.apply([]);                    // "[object Array]"
                Object.prototype.toString.apply(function(){});     // "[object Funtion]"
                Object.prototype.toString.apply(null);                 //"[object Null]"
                Object.prototype.toString.apply(undefined);        //"[object Undefined]"
            
            PS:  IE6/7/8的null会返回 "[object Object]"

    数组方法:
        arr.join();  //把数组的所有元素输出成字符串,并用指定分隔符连接,默认为“,”
        arr.sort();  //排序

    字符串方法:

      str.split(",");  //以特定字符分割字符串,同时返回成数组  这一点和 join()是反的
      str.substring(start,end);    //写法小写,作用提取字符串
      str.indexOf("gdgdf");       //返回查询的子字符串起始位置,没有则返回-1

  • 相关阅读:
    火狐浏览器看哪些地方加nofollow
    2017.6.14-网站分析
    2017.6.11-目标关键词优化 三个方面内容
    2017-6-9长尾关键词优化
    2017.6.7seowhy学习笔记---seo知识总纲
    使用 WordPress 自定义字段功能为文章添加下载按钮
    xftp和xshell有什么区别
    决定网站排名的6个干货
    转载:如何在wordpress主题中添加设置页面
    win10+ubuntu双系统安装方案
  • 原文地址:https://www.cnblogs.com/grey-zhou/p/5631214.html
Copyright © 2011-2022 走看看