Skip to content

Commit 34eecd8

Browse files
authored
Use nullish coalescing for safeArgs initialization
1 parent c76be10 commit 34eecd8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/math/math.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ function math(p5, fn) {
111111
}
112112

113113
const safeArgs =
114-
arguments.length === 1 ? [x, 0, 0]
115-
: arguments.length === 2 ? [x, y, 0]
114+
arguments.length === 1 ? [x ?? 0, 0, 0]
115+
: arguments.length === 2 ? [x ?? 0, y ?? 0, 0]
116116
: [...arguments];
117117

118118
if (this instanceof p5) {

0 commit comments

Comments
 (0)