Skip to content

Instantly share code, notes, and snippets.

@ElijahLynn
Created March 10, 2015 18:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElijahLynn/a13f1a314d95f599de99 to your computer and use it in GitHub Desktop.
Save ElijahLynn/a13f1a314d95f599de99 to your computer and use it in GitHub Desktop.
meetupWaitlistNumber
// Taken from comment by Eli Hellmann @ http://www.meetup.com/AngularJS-NYC/events/221056642
Array.prototype.reduce.call($('#rsvp-list-waitlist li'), function(agg,e,i){return agg || (/Elijah Lynn/i.test($(e).text()) ? i : agg);},null) //:)
@ElijahLynn
Copy link
Author

An attempt at making this a bit more readable.
Array.prototype.reduce.call($('#rsvp-list-waitlist li'), function (previousValue, currentValue, index, array) { return previousValue || (/Elijah Lynn/i.test($(currentValue).text()) ? index : previousValue); }, null );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment