How to support a new ES standards code with ES3 browsers


#1

Hi everyone! How Babel helps me for support old browsers with ES3 (e.g. IE7-8)?
For example. I have following simple code written in ES6 standard

'use strict';

class Alert {
    constructor() {
        let a = [1, 2, 3];
        a.forEach((value) => {
            console.log(value);
        });
    };
}

console.log(new Alert());

Babel transpiles this code to ES5

'use strict';

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Alert = function Alert() {
    _classCallCheck(this, Alert);

    var a = [1, 2, 3];
    a.forEach(function (value) {
        console.log(value);
    });
};

console.log(new Alert());

As we know, ES3 browsers does not support Array.prototype.forEach() method… How should I organize my project using Babel with ES3 browsers support? And how to build it to one single production .js file?