mozilla
Your Search Results

    Generator

    This article is in need of a technical review.

    This article is in need of an editorial review.

    Summary

    Lets you work with generators.

    Syntax

    function fibonacci(){
    	var fn1 = 1;
    	var fn2 = 1;
    		while (1){
    			var current = fn2;
    			fn2 = fn1;
    			fn1 = fn1 + current;
    			yield current;
    		}
    	}
     
    var it = fibonacci();
    var it2 = (i * 2 for (i in it));
    

    Methods

    For methods available on Generator instances, see Methods of Generator instances.

    next
     
    send
     

    Document Tags and Contributors

    Contributors to this page: Sheppy, thesebas, SphinxKnight
    Last updated by: SphinxKnight,