0

I have the following function:

         function getMeasurementEventProperties() {
                changedMeasurements.push("none");
                finalMeasurements = [...new Set(changedMeasurements)];
                if (finalMeasurements.length > 1) {
                    var finalMeasurements = finalMeasurements.filter(function (measurement) {
                        return measurement !== 'none'
                    });
                    return finalMeasurements.join(",").replace(/,/g, ', ')
                }
                return finalMeasurements.join(",").replace(/,/g, ', ')
            }

However they are failing unit tests (in Internet Explorer only) saying that there is a syntax error on line finalMeasurements = [...new Set(changedMeasurements)]; - is this not supported by IE? Or have I got the syntax incorrect here?

Jordan1993
  • 864
  • 1
  • 10
  • 28
  • 1
    If the tests are failing in IE and passing elsewhere, does that not answer your question? – jonrsharpe Feb 27 '20 at 11:57
  • The [Spread syntax doesn't support IE browser](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax), you could try to use [Babel](https://babeljs.io/repl) translate the code to browser-compatible JavaScript. – Zhi Lv Feb 28 '20 at 04:00

0 Answers0