Skip to content

editor.p5js.org freeze #4379

Open
Open

Description

@cirelevuahc

p5.js version

2.3.4

What is your operating system?

Mac OS

Web browser and version

Firefox 158.0

Actual Behavior

When i use private variable class, combined with while loop in draw() function, run freeze !
Whitout while loop, it's ok.

Expected Behavior

That the Web editor accept private variable.

Steps to reproduce

let i = 0;
let person;

function setup() {
  createCanvas(400,` 400);
  person = new Person('George', 20);
  person.display();
}

function draw() {
  background(220);
  textSize(50);
  fill(0);
  text('Hello',50, 50);

  while(i < 10) {
    console.log(`i ${i}`);
    i += 1;
  }
}

class Person {
  #name;
  #age;
  
  constructor(name, age) {
    this.#name = name;
    this.#age = age;
  } 

  display() {
    console.log(`name ${this.#name} age ${this.#age}`);
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting Maintainer ApprovalNeeds review from a maintainer before moving forwardBugError or unexpected behaviors

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions