this 、typeof、false、parseInt()、this、arguments、Array和object判断

typeof
typeof (undefined) 不会报错
undefined object Number boolean function String 返回值为字符串类型


false
0false 、“”、undefined、null、NaN
除了以上六种都为true
null == undefined  true
null === undefined false
parseInt()
parseInt(String,radix)解析String的第一个字符,如果是数字,继续解析,不是则返回NaN

parseInt('1c3cc4cblllll') 返回1
this
1、函数预编译时,this===》》window
2、全局作用域里,this==》》window
3、call和apply 改变this指向
4、object.function this==》》object 谁调用function 方法里面的this就执行谁,,如果方法空执行时,则为window

只要没有使用 obj.xxx(),其他方式都是相当于空执行,this == 》》window
arguments  方法中的实参列表(类数组)他没有数组通用的方法
类数组 : 必须要有length属性
 var obj = {

        0 : "a",
        '1' : 'b',
        '2' : 'c',
        length : 3,
        push : Array.prototype.push
 }

function test(){
  console.log(arguments.callee)//指向函数自身引用

}
  
递归时,表示函数
     var sum = (function (n){
            if(n == 1 )
            {
                return 1;
            }
            return n * (arguments.callee)(n-1);
        }(5));
 Array和object判断
三种方法
{
  1:obj instanceof Array ps: Obj的原型链上有没有Array对象

  2: constructor 看构造函数是不是Array

  3: toString Object.prototype.toString.call(); 推荐

1和2 有父子域的问题

 

 

 

 


}

数组排序

返回正数位置  b 在 a前
返回负数 a 在 b前
返回0 ab位置不变 不变
var arr = [1,2,10,5]; arr.sort(function (a,b){ return b -a; })


改变元素组的七个方法
push() , pop().shift(),unshift(),sort(),reverse(),splice
不改变原数组
concat(),toString(),slice(),join()

  

转载于:https://www.cnblogs.com/guyuedashu/p/11567909.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值