Change Language


Follow Navioo On Twitter

yield

Generator that returns the value for each step in a loop.

Syntax

yield (object)
    variable 

Example

function fib() {
  var i = 0, j = 1;
  while (true) {
    yield i;
    var t = i;
    i = j;
    j += t;
  }
}

var g = fib();
for (var i = 0; i \n");
}
		

Remarks

Available in JavaScript 1.7+. Implemented in Firefox 2.0.

text_javascript Navioo_docs

Ajax Javascript feed

↑ Grab this Headline Animator