admin管理员组

文章数量:1331616

I see parseInt() and parseFloat() when I hit TAB in the console.

I can just type:

parseInt('123asd');

But where are these located?

I see parseInt() and parseFloat() when I hit TAB in the console.

I can just type:

parseInt('123asd');

But where are these located?

Share Improve this question asked Nov 10, 2010 at 20:16 ajsieajsie 79.9k110 gold badges284 silver badges386 bronze badges 5
  • Which console are you referring to ? – Barry Commented Nov 10, 2010 at 20:17
  • 1 They're located in your puter three bits to the left of the microprocessor...They're in the global scope if that's what you're asking. – zzzzBov Commented Nov 10, 2010 at 20:18
  • function parseInt() { [native code] } – Josh Stodola Commented Nov 10, 2010 at 20:19
  • @Barry: Chrome's console, but also Node.js. – ajsie Commented Nov 10, 2010 at 20:21
  • 1 @zzzzBov They are in the global namespace. – Šime Vidas Commented Nov 10, 2010 at 20:28
Add a ment  | 

2 Answers 2

Reset to default 8

They are properties of the global object. (built-in functions)

In the case of the browser, this is window.

parseInt and parseFloat are attached to the "Global" javascript object therefore they are available in all contexts.

本文标签: javascriptWhere are parseInt() and parseFloat() locatedStack Overflow