Timeline for answer to Prototypes and __proto__ in JavaScript by JLRishe
Current License: CC BY-SA 3.0
Post Revisions
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 20, 2020 at 9:12 | history | edited | Community Bot |
Commonmark migration
|
|
| Jan 20, 2018 at 18:20 | history | edited | JLRishe | CC BY-SA 3.0 |
added 1 character in body
|
| Jan 20, 2018 at 17:48 | vote | accept | Gaurav Chaudhary | ||
| Jan 20, 2018 at 17:47 | comment | added | JLRishe | @GauravChaudhary Yes. | |
| Jan 20, 2018 at 17:47 | comment | added | Gaurav Chaudhary |
okay! So Function() is an object of type function right? @JLRishe
|
|
| Jan 20, 2018 at 17:47 | comment | added | JLRishe | @GauravChaudhary In JavaScript, anything that is not a primitive is technically an object, so yes, functions are objects. | |
| Jan 20, 2018 at 17:46 | comment | added | Gaurav Chaudhary |
Thanks! I got it but still I would like to know typeof(Function()) is function but it acts like an object?
|
|
| Jan 20, 2018 at 17:44 | history | edited | JLRishe | CC BY-SA 3.0 |
deleted 1 character in body
|
| Jan 20, 2018 at 17:43 | comment | added | JLRishe |
@GauravChaudhary Because that's what it's designed to do. I don't see any reason to assume that Function() and Object() would do the same thing, but Function() does create a value based on the Function prototype, which is analogous to what Object() does: Function().__proto__ === Function.prototype is true.
|
|
| Jan 20, 2018 at 17:42 | history | edited | Caramiriel | CC BY-SA 3.0 |
added 3 characters in body
|
| Jan 20, 2018 at 17:40 | comment | added | Gaurav Chaudhary |
Not the same case with Function(). That's why I was confused. So why Function() evaluates to an anonymous function?
|
|
| Jan 20, 2018 at 17:37 | history | answered | JLRishe | CC BY-SA 3.0 |