Search code examples
javascriptphpstorm

Why PhpStorm is highlighting this as error in my JavaScript declaration


I've declared this JS function and PhpStorm is highlighting it as an error, saying that ,or) expected.

function getData(params, toCache=true) { ...

enter image description here

Why is PhpStorm highlighting toCache=true as an error? Is this not the correct way to declare default params in JavaScript? My code is working, so is this just a bug in PhpStorm.


Solution

  • This is probably because default parameters are part of ES6 specification and your project environment is set to ES5.