How to declare a constant in Processing editor & p5.js? (reported issue)

Kevin, is the following MCVE enough? I’ve done this MCVE by making a copy of the p5.js sketch from Processing IDE, with the ‘Save as…’ command. Still the same error. BUT when I create a new p5.js sketch into Processing IDE and replace the default .js and .html code with a copy of the MCVE code, the error does not occurs… I’m asking myself if this could result of a file corruption (problem of character encoding for instance)…

.js

const PASSWORD_MIN_LENGTH = 4;

var username;
var password;
var firstname;
var lastname;
var birthday;
var birthMonth;
var birthYear;
var gender;
var statusMsg = "";


function setup() {
  
   createCanvas(windowWidth, 50);

}

function draw() {
  
}

.html

<html>
<head>
  <meta charset="UTF-8">

  <!-- PLEASE NO CHANGES BELOW THIS LINE (UNTIL I SAY SO) -->
  <script language="javascript" type="text/javascript" src="libraries/p5.js"></script>
  <script language="javascript" type="text/javascript" src="libraries/p5.dom.js"></script>
  <script language="javascript" type="text/javascript" src="MCVE.js"></script>
  <!-- OK, YOU CAN MAKE CHANGES BELOW THIS LINE AGAIN -->

  <!-- This line removes any default padding and style. 
       You might only need one of these values set. -->
       
       
  <style>

    body {padding: 0; margin: 0; font-family:Arial, Helvetica, sans-serif;}
  
 </style>

</head>

<body>




</body>
</html>
1 Like