replace(value)
Replaces all filled cells in the quadrille with the specified value — empty cells are untouched: the exact complement of fill(value), which touches only empties. Chained, they two-tone a board totally: q.replace(red).fill(green) turns every filled cell red and every empty cell green. Returns the quadrille (chainable).
Example
(click or press any key to toggle between replacing cells and resetting)
Note
Like fill(value), a non-factory
valueis stored as one shared instance across all replaced cells — see the identity note there: it is what makes the replaced region strict-searchable and floodable as one.
Syntax
replace(value)
Parameters
| Param | Description |
|---|---|
value1 |
Any: A valid JavaScript value |
What this page's examples use
- p5.quadrille
drawQuadrillecreateQuadrillecellLengthrandreplace- p5.js
createCanvasbackgroundcolor
Names the analysis can prove are called, and the line each one is documented on. Local variables and members of an unknown receiver are left out.