Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2015年1月7日 D7 #37

Open
nunnly opened this issue Jan 7, 2015 · 7 comments
Open

2015年1月7日 D7 #37

nunnly opened this issue Jan 7, 2015 · 7 comments
Labels

Comments

@nunnly
Copy link
Owner

nunnly commented Jan 7, 2015

大家都知道JS里面判断类型最准确的是什么吧
Object.prototype.toString.call(obj)
那么问题来拉~!

function typeO(string){
console.log(Object.prototype.toString.call(arguments))
}

typeO("带你飞");// 这里会输出啥
@nunnly nunnly added the question label Jan 7, 2015
@think2011
Copy link
Collaborator

估计是.. [object, arguments],因为我以前试过。
但是不是很明白,求详解!

@qingo
Copy link

qingo commented Jan 7, 2015

[object, arguments]

@think2011
Copy link
Collaborator

[object Arguments] 呀。

@qingo
Copy link

qingo commented Jan 7, 2015

我输了 木有逗号

@kingsea
Copy link

kingsea commented Jan 23, 2015

为啥呢?

@nunnly nunnly added 难度7 and removed question labels Jan 23, 2015
@VaJoy
Copy link

VaJoy commented Feb 27, 2015

arguments是一个类数组的对象嘛,所以才输出的[object Arguments],如果是

function typeO(string){
console.log(Object.prototype.toString.call(string))
}

typeO("带你飞");

就输出 [object String]

@lzzwoodtree
Copy link

@VaJoy Arguments本身就是规范里面的一个内置类型
http://www.cnblogs.com/ziyunfei/archive/2012/11/05/2754156.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants