Iterator.prototype.hasNext >= 0.1.2

Purpose

See if there is a next item

Syntax

Iterator#hasNext ( );

Parameters

Return values

Boolean

Examples

var arr = ['a', 'b', 'c'],
    iter = new Iterator(arr);

iter.hasNext();
>>> true

iter.next();
>>> {index: 0, value: "a", done: false}

iter.next();
>>> {index: 1, value: "b", done: false}

iter.next();
>>> {index: 2, value: "c", done: false}

// All items will be fetched now, so hasNext will return false
iter.hasNext();
>>> false

Comments