As soon as I saw like 18 minutes of the Google Wave preview video (http://wave.google.com), I was stunned and at the same time asking myself, howcome this didn't exist earlier, because it's a simple concept although it's a revolution in the web communication/collaboration "market".
The video it's definitely worth the view, and my guess is that this will overcome email and all the current social/collaboration tools/sites, because the nailed it right on the spot!
Congrats to Google!
Blog about programming, jquery, ajax, web technologies, solution's arquitecture, and more!
Thursday, June 4, 2009
Thursday, May 14, 2009
Filter javascript array items with jquery
In JQuery there's a function that allows us to filter specific items of an array:
The test_changed array would only contain the pineaple and the strawberry item.
Dismitify:
The parameters of the $.grep function are:
First parameter is the array you want to manipulate
Second parameter is the function that executes the filter on the array (returns true for that item to remain and false for that item to be excluded. The function is called for each item of the array).
This filtering function gets two parameters:
The first one is the current array item (current of the iteration)
The second one is the current array position (aka index).
I hope this is useful for you as it was for me!
Be back soon!
var test = ["pineaple","apple","strawberry"];
var test_changed = $.grep(array, function(n, i) { return n!="apple"; });
The test_changed array would only contain the pineaple and the strawberry item.
Dismitify:
The parameters of the $.grep function are:
First parameter is the array you want to manipulate
Second parameter is the function that executes the filter on the array (returns true for that item to remain and false for that item to be excluded. The function is called for each item of the array).
This filtering function gets two parameters:
The first one is the current array item (current of the iteration)
The second one is the current array position (aka index).
I hope this is useful for you as it was for me!
Be back soon!
Preface
Very well, I never had a blog before, since there's so much buzz about it, I decided to try it and start a little blog about (for now) subjects related with software development and all that it concerns.
I hope this blog will come in good use to all the visitors and I'll be looking forward for your comment.
I'll be waiting! Thank you!
I hope this blog will come in good use to all the visitors and I'll be looking forward for your comment.
I'll be waiting! Thank you!
Subscribe to:
Posts (Atom)