785Filtering Arrays with ECMAScript 5 and filter()

Suppose you have an array of object:
var array = [ 	{a:13, b:false },
		{a:7, b:true },
		{a:78, b:true } ]		
The old, ECMAScript 3 way of checking for objects, in which b is true would be a simple for-loop:
var results = [];
for (var i=0; i

Ok, that's working, but not very elegant nor concise. Luckily, ECMAScript 5 offers a nicer way:

var results = array.filter( function(item) {
	return item.b;		// if item.b is true