Whilst doing some cleanup of some Aura Components for Summer 16, I was creating a JS function in my helper. I had wanted to add some default values to that function using the new ES6 Default Parameter Value Spec. Like so:

myFunction = function (param1 = "this", param2 = "that"){

Meaning that if I invoked this like

> param1 = "this"
> param2 = "that"

helper.myFunction("what is");
> param1 = "what is"
> param2 = "that"

No luck. I get an error when I attempt to save the component on the server as such:

ERROR: 0Ad240000008RPA: org.auraframework.util.json.JsonStreamReader$JsonStreamParseException: Expected ',' or ')' [64, 30]: '='

2 Answers 2


I have just bumped in this issue and I would like to share my findings.

The following syntax is still not supported (you'll get a JsonStreamParseException):

myFunction = function (param1 = "this", param2 = "that")

However, if you write it this way (without spaces around the equal signs), the default parameter values work fine:

myFunction = function (param1="this", param2="that")

I hope this will help someone.

  • LOL! Because whitespace doesn't matter in JS, right? Good job ferreting out how to get this to work!
    – pchittum
    Jan 9, 2018 at 12:01
  • For the record, according to the Lightning team this is a Closure compiler bug. This ES6 syntax is not officially supported in Lightning so it could go away in the future if the compiler is updated.
    – POZ
    Jan 9, 2018 at 12:45
  • The marked answer no longer works in 20 regrettably. Oct 25, 2019 at 19:46

It turns out Lightning Components are using a version of closure compiler that is incompatible with this syntax currently. So as of Summer 16, certain syntax that is ES6 compliant will not work with Lightning Components.

I found this out through raising an issue with the aura open source framework repo in github.

Note: this is not an issue in Lightning Web Components

  • 3
    The problem is even more critical than that. While you are in Debug Mode (Setup>Build>Develop>Lightning Components) and you are working in an ES6 compatible browser (e.g. Chrome supports natively default parameters), then you will not notice any issue because Closure is just not minifying your code. The problem occurs when you turn off the Debug Mode, letting you possibly with many unexpected/undebuggable/etc. errors... Jul 20, 2016 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.