'JSF 2.3.14: Syntax error after (re-) rendering a JavaScript code block with constants

The following code fragment generates a javascript syntax error when I push the h:commandButton:

<h:outputScript>
  'use strict';
  const label = '*';
</h:outputScript>
<h:form>
  <h:commandButton>
    <f:ajax render="@all" />
  </h:commandButton>
</h:form>

SyntaxError: redeclaration of const label

The problem is the const label = '*'. How to deal with that in this case?

Mojarra 2.3.14



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source