Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

what is function in javascript

what is function in javascript  using -'javascript,function,ecmascript-6'

In this page I found a new JavaScript function type:

// NOTE: "function*" is not supported yet in Firefox.
// Remove the asterisk in order for this code to work in Firefox 13

function* fibonacci() { // !!! this is the interesting line !!!
    let [prev, curr] = [0, 1];
    for (;;) {
        [prev, curr] = [curr, prev + curr];
        yield curr;

I already know what yield, let and [?,?]=[?,?] do, but have no idea what the function* is meant to be. What is it?

P.S. don't bother trying Google, it's impossible to search for expressions with asterisks (they're used as placeholders).

asked Sep 14, 2015 by Sherri3192u
0 votes

Related Hot Questions

Government Jobs Opening