This project is read-only.

selectPair(valueSelector, keySelector[, arg])

Projects each element of a sequence into a new form including keys.

Syntax

Parameters

valueSelector
Type: function(value, key, arg)
keySelector
Type: function(value, key, arg)
arg
An external argument.
Return Value

An iteratable object whose elements are the result of invoking the transform function on each element of source.

Examples

var squares = $range(1, 11).selectPair("$ * $", "$");
squares.each("document.writeln('The square of ' + $$ + ' is ' + $)");

/*
 This code produces the following output:

 The square of 1 is 1
 The square of 2 is 4
 The square of 3 is 9
 The square of 4 is 16
 The square of 5 is 25
 The square of 6 is 36
 The square of 7 is 49
 The square of 8 is 64
 The square of 9 is 81
 The square of 10 is 100
*/

Last edited May 18, 2012 at 9:52 AM by suckgamoni, version 1

Comments

No comments yet.