back to Overview

_.range()

Creates a new Minified list containing an interval of numbers from start (inclusive) until end (exclusive).

Syntax Variants

_.range(end)
_.range(start, end)

Parameters

start (optional)
the start number. If omitted, the range starts at 0.
end
the end of the range (exclusive)
(return value)
the new Minfied list containing the numbers. Empty is start is not smaller than end.

Description

Creates a new Minified list containing an interval of numbers from start (inclusive) until end (exclusive). start can also be omitted to start at 0.

Example

Creates some ranges

var l123 = _.range(1, 4);      // same as _(1, 2, 3)
var l0123 = _.range(3);        // same as _(0, 1, 2)
var neg123 = _.range(-3, 0);   // same as _(-3, -2, -1)
var empty = _.range(2,1);      // same as _()

Comments

comments powered by Disqus

back to Overview

Functions