cancel
Showing results for 
Search instead for 
Did you mean: 

SAP WebIDE Full Stack ES6 syntax error

former_member516423
Participant
0 Kudos

Hello,

I have this function but the IDE said syntax error

_calculateTotalHours: function (oResult) {
return oResult.results.reduce((total, currentValue) => total + parseFloat(currentValue.Hours).toFixed(2),0);
},

I did add ES6 to javascript validator rule.

I clear cache and refresh the project but the error persists.

What else do I need to do?

Thanks

Tri

former_member560141
Participant
0 Kudos

I think you have a syntax error. I am no es6 expert but try adding {} like:

_calculateTotalHours: function (oResult) {
    return oResult.results.reduce((total, currentValue) => {
        total + parseFloat(currentValue.Hours).toFixed(2),0);
    }
},

former_member516423
Participant
0 Kudos

Hi Nicholas Owen O’Malley,

I tried your code but still the same.

Thanks

Tri

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Tri,

actually, your code works for me. No syntax error in Web IDE

else try this:

_calculateTotalHours: function(oResult) {
      return oResult.results.reduce((total, currentValue) => 
	{ return total + parseFloat(currentValue.Hours).toFixed(2) }, 0);
},

best,

Cuong

former_member516423
Participant
0 Kudos

Hi Cuong,

Thanks for your solution.

However, it seems something wrong with IDE config. When I click the "ESLINT" link, it leads me to ESLINT which is version 5.1

I think somehow my WebIDE doesn't support ES6.

Regards,

Tri