toArray()

Creates an array from an iteratable object.

Syntax

Return Value

An array that contains the elements from the input sequence.

Examples

var packages = [
    { company: "Coho Vineyard", weight: 25.2 },
    { company: "Lucerne Publishing", weight: 18.7 },
    { company: "Wingtip Toys", weight: 6.0 },
    { company: "Adventure Works", weight: 33.8 } ];

var companies = $from(packages).select("$company").toArray();

for (var i = 0; i < companies.length; ++i) {
	document.writeln(companies[i]);
}

/*
This code produces the following output:

Coho Vineyard
Lucerne Publishing
Wingtip Toys
Adventure Works
*/

Last edited May 18, 2012 at 11:21 AM by suckgamoni, version 1

Comments

No comments yet.