typeof

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

false

 、false 、“”、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()

  

this 、typeof、false、parseInt()、this、arguments、Array和object判断的更多相关文章

  1. typeof升级版,可以识别出array、object、null、nan、[]、{}

    typeof 经常混淆array.object.null等,升级处理一下. 可以将这个函数放在common.js中使用. function getTypeName(v) { var v_str = J ...

  2. typeof操作符,返回数据类型Array.isArray()、Object.prototype.toString.call()

    源地址https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/typeof typeof操作符 // N ...

  3. Javascript中判断变量是 array还是object(是数组还是对象)

    段文字是从github上截取由本人翻译过来的. 原文地址:https://github.com/nathansmith/javascript-quiz/blob/master/ANSWERS.md 怎 ...

  4. Javascript中判断变量是数组还是对象(array还是object)

    怎样判断一个JavaScript变量是array还是obiect? 答案: 1.如果你只是用typeof来检查该变量,不论是array还是object,都将返回‘objec'. 此问题的一个可行的答案 ...

  5. 判断 js 的 Array 和 Object

    https://my.oschina.net/ohcoding/blog/470952?p=1 var a = ['hello','world']; console.log(typeof a); // ...

  6. Poco::JSON::Array 中object 设置preserveInsertionOrder 时,stringify出错-->深入解析

    在使用poco version 1.6.0时 Poco::JSON::Array 在object  设置preserveInsertionOrder =true 时 调用 array.stringif ...

  7. Array与Object

    typeof([ ])的返回值是object,因为数组叫做数组对象. Array有length属性,而Object没有length属性,所以可以根据length属性来判断数据属于数组还是对象. Arr ...

  8. 不要将 Array、Object 等类型指定给 prototype

    在 JavaScript 中,注意不要将 Array.Object 等类型指定给 prototype,除非您的应用需要那么做.先观察如下代码: function Foo(){}Foo.prototyp ...

  9. AFNetworking 关于JSON text did not start with array or object and option to allow fragments not set 错误

    AFHTTPSessionManager *manager =[AFHTTPSessionManager manager]; [manager GET:@"http://www.baidu. ...

随机推荐

  1. 剑指offer——69队列的最大值

    题目: 队列的最大值.请定义一个队列并实现函数max得到队列里的最大值,要求函数max.push_back和pop_front的时间复杂度都是O(1). 题解: 使用队列,操持队列的排序为从大到小的顺 ...

  2. vue中的import {} from '@/api/api'

    例:import {queryDepartTreeList, searchByKeywords} from '@/api/api' 首先查看vue.config.js文件,在这个文件里面定义了定义了@ ...

  3. runtime机制

    runtime(简称运行时),是一套 纯C(C和汇编写的) 的API.而 OC 就是运行时机制,也就是在运行时候的一些机制,其中最主要的是消息机制. 消息机制原理:对象根据方法编号SEL去映射表查找对 ...

  4. C—变量—register

    Tips 1.寄存器变量可以用来优化加速c语言程序 2.声名只需在类型前多加register 即可,eg register int quick; (quick 就是一个整形的寄存器变量) 3.regi ...

  5. delphi xe10 文件目录/路径操作 (Andorid、ios)

    //获取临时文件路径(支持安卓.IOS) function GeFileName(const AFileName: string): string; begin {$IFDEF ANDROID} Re ...

  6. 判断访问浏览器客户端类型(pc,mac,ipad,iphone,android)

    <script type="text/javascript"> //平台.设备和操作系统 var system = { win: false, mac: false, ...

  7. cookie中文转码

    //cookie中文转码 var GB2312UnicodeConverter = { //转码 ToUnicode: function(str) { //中文转unicode return esca ...

  8. dfs版容斥原理+剪枝——bzoj1853

    学了一种爆搜版+剪枝的容斥方法,即类似数位dp时按位进行容斥,同时需要在搜索过程中进行剪枝 /* 容斥原理,先在打出的表里筛掉所有倍数,然后用容斥原理+1个的倍数-2个lcm的倍数+3个lcm的倍数. ...

  9. lua的运算符

    1.赋值运算符 --赋值 str="helllo".."world" print(str) a,b=10,20 print(a,b) c,d,e=1,2 pri ...

  10. NX二次开发-UFUN体找面函数UF_MODL_ask_body_faces

    NX9+VS2012 #include <uf.h> #include <uf_modl.h> #include <uf_obj.h> #include <u ...