How to use switch() in JavaScript - basics

Опубликовано: 25 Июнь 2026
на канале: Matthew Bardin
86
3

This video uses the p5play library (version 3) to show how to utilize the switch() operator in JavaScript. I use this operator in order to move a sprite around the canvas.
You can use a switch() to have the code respond to the value of a variable or other piece of data.
The sketch I made in this video: https://editor.p5js.org/mbardin/sketc...
MDN page on switch(): https://developer.mozilla.org/en-US/d...

#p5js #p5play #js