Skip to content

reserved function "width" error message shows for valid code #5734

@KevinWorkman

Description

@KevinWorkman

I'm using the latest version of the p5.js editor (p5.js version 1.4.1), and I have code like this:

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  
  // This line causes an error: "p5.js says: you have used a p5.js reserved function "width" 
  // make sure you change the function name to something else."
  let x = constrain(200, 0, width);
  
  circle(x, 200, 100);
}

When I run the sketch, the code works fine and I see a circle, but I also see this error message in the console:

p5.js says: you have used a p5.js reserved function "width" make sure you change the function name to something else.

+ More info: https://p5js.org/reference/#/p5/width 

Details about the bug:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions