Nah.. both won.. include() is not strict.. with your example i could
force that by using ===
so... i asked for one function and got myself two.. Thank you :)


PS: include should get a boolean modifier to enable strict comparsion.

On 1/19/07, Nicholas Schlueter <[EMAIL PROTECTED]> wrote:

ok yours is better, you win :)

On 1/19/07, Thomas Fuchs <[EMAIL PROTECTED]> wrote:
>
> ['a','b','c'].include('b') --> true
>
> See http://prototypejs.org/api/enumerable/include
>
> Best,
> Thomas
>
>
> Am 19.01.2007 um 17:46 schrieb Kjell Bublitz:
>
> >
> > Hi
> >
> > i was wondering if there is a quick way to search for a item within an
> > array. Here is my approach for this functionality. It's an prototype
> > for an Array method called "has":
> >
> > Array.prototype.has = function(needle) {
> >       for (var i=0;i<this.length;i++) {
> >               if(this[i] == needle){ return true; }
> >       }
> >       return false;
> > }
> >
> > var someArray = ['jim', 'marge', 'timmeh', 'bob'];
> >
> > if( someArray.has('bob') )
> > {
> >    alert('found bob')
> > }
> >
> > Isn't there something like "has()" in prototype already? I have seen
> > the find / findAll, but the example in the docs are kinda complex for
> > "just that".. could someone break it down for me please? i would much
> > appreciate.
> >
> > TIA, Kjell
> >
> > >
>
>
> >
>


--
DCRails.com || Making the Metrorail fun!
http://www.captureimportant.info || Sidewalk || Bring People to You

>



--
Kjell
-- www.m3nt0r.de

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to