On Dec 23, 8:39 pm, Simon Thomas <[EMAIL PROTECTED]> wrote:
> Just after some feedback really, any reason not to do it like this? or
> any glaringly obvious bad practices??

It depends. Some would consider it bad practice to add methods
directly to the global scope, but that applies far more to libraries
than it does to one's own code. (After all, you know what's best for
your environment.) We define the methods on Object because we'd rather
play it safe and minimize possible conflict with global methods. We
don't define them on Object.prototype because that *is* bad practice
[1].

If you want to "import" the isFoo methods into window, you can do it
like this:

for (var m in Object)
  if (m.startsWith("is")) window[m] = Object[m];

No need to rewrite the logic.

Cheers,
Andrew


[1] http://erik.eae.net/archives/2005/06/06/22.13.54
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to