processing / processing/p5.js

[p5.js 2.0 Bug Report]: noise(null) is treated as noise(0) while noise(undefined) errors, and this behaviour is undocumented and inconsistent.

Open
#8,407 15 comments 0 reactions 1 assignee View on GitHub

@jeetsdev is already working on this.

Since Jun 22, 2026.

Bug Good First Issue Help Wanted p5.js 2.0+
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)
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:
  1. Run the sketch below
  2. Compare the outputs of noise(null) and noise(0)
  3. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.