One of the most important feature introduced in Javascript ES6 is the Generator function, which provides the ability to suspend the execution of a function. However, not all browsers and platforms support generator right now. Earlier versions of Firefox either had ES6 generators turned off, or supported only old style generators. On Chrome 28, you have to turn on an experimental flag named Enable Experimental JavaScript. Node.js haven’t got generator support until version 0.11.2 and you have to run it with --harmony flag.

You have another option that is to compile the javascript files using Regenerator, an ES6 to ES5 Javascript compiler (Google also has their own compiler called Traceur). Regenerator is available on npm

$ npm install -g regenerator

The command to transform js file is simple. You need to include the runtime file in your result html file.

$ regenerator es6.js > es5.js

If you want Regenerator to include the runtime automatically for you in all files that it generates, use --include-runtime flag

$ regenerator --include-runtime es6.js > es5.js

If you want to use Regenerator with Gulp (read more at Automate Javascript development with Gulp), you need to install gulp-regenerator.

$ npm install --save-dev gulp-regenerator

To use it, simply pipe it to a gulp task

var gulp = require('gulp');
var regenerator = require('gulp-regenerator');

gulp.task('default', function () {
    gulp.src('src/app.js')
        .pipe(regenerator())
        .pipe(gulp.dest('dist'));
});

You can also include the runtime with options.includeRuntime

var gulp = require('gulp');
var regenerator = require('gulp-regenerator');

gulp.task('default', function () {
    gulp.src('src/app.js')
        .pipe(regenerator({includeRuntime: true}))
        .pipe(gulp.dest('dist'));
});

Another example for a gulp task that pipes multiple actions

var gulp = require('gulp');
var regenerator = require('gulp-regenerator');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');

gulp.task('default', function () {
    gulp.src('src/app.js')
        .pipe(regenerator({includeRuntime: true}))
        .pipe(uglify())
        .pipe(rename({suffix: '.min'}))
        .pipe(gulp.dest('dist'));
});