Most appropriate sub-area of p5.js?
p5.js version
2.1.2
Web browser and version
Google Chrome Version 143.0.7499.170
Operating system
Windows 11
Steps to reproduce this
Steps:
- Run the sketch below
- Compare the outputs of noise(null) and noise(0)
- Observe that they are identical, while noise(undefined) throws an FES warning
Snippet:
function setup() {
noCanvas();
console.log("null:", noise(null));
console.log("0:", noise(0));
console.log("undefined:", noise(undefined));
}
Explanation:
noise(null) returns the same value as noise(0), while noise(undefined) produces a NaN and a Friendly Error message. Both null and undefined represent missing values in JavaScript, but they are handled differently here. This behaviour is not documented and can lead to silent bugs when null is passed unintentionally.
I'm happy to take on this task, if this is approved