0

How should I refactor script:

  swangular.confirm("Are you sure?", {
            showCloseButton: true,
            showCancelButton: true
        }).then((result) => {
            if (result.value) {
                console.log("confirm");
            } else {
                console.log("cancel");
            }
          }
        );

to be compatible with ES5?

Currently I receive: Unexpected token: operator (>) inside 'then' codeblock.

Michal_Szulc
  • 4,097
  • 6
  • 32
  • 59
  • 2
    Hey, not sure why this was closed. The issue is the array function. You can change `(result) =>` to `function(result)` and you should be good! – Nick Oct 25 '19 at 23:22
  • Thanks Nick for a quick help! If you publish it as an answer, I will accept it. – Michal_Szulc Oct 25 '19 at 23:24
  • Thanks! Someone already flagged this question as duplicate, so I can’t answer. I don’t think it’s duplicate though. Oh well! – Nick Oct 25 '19 at 23:26
  • 1
    You can use tools like [Babel](https://babeljs.io/repl) to transpile newer JS to ES5. – Ivar Oct 25 '19 at 23:27
  • Thanks @Ivar . I will definitely check it out! – Michal_Szulc Oct 25 '19 at 23:28

0 Answers0