Cell Contents
These methods focus on determining the value and type of cells at a specific (row, col) position:
- read(row, col): Returns the content of the cell at the specified
rowandcol. - isValid(row, col): Checks if the specified cell at
rowandcollies within bounds. - isEmpty(row, col): Checks if the specified cell at
rowandcolis empty. - isFilled(row, col): Checks if the specified cell at
rowandcolcontains non-empty content. - isBoolean(row, col): Determines if the specified cell at
rowandcolcontains a boolean. - isNumber(row, col): Determines if the specified cell at
rowandcolcontains a number. - isBigInt(row, col): Determines if the specified cell at
rowandcolcontains a bigint. - isString(row, col): Determines if the specified cell at
rowandcolcontains a string. - isColor(row, col): Checks if the specified cell at
rowandcolcontains a color. - isImage(row, col): Checks if the specified cell at
rowandcolcontains an image. - isArray(row, col): Determines if the specified cell at
rowandcolcontains an array. - isFunction(row, col): Determines if the specified cell at
rowandcolcontains a function. - isObject(row, col): Determines if the specified cell at
rowandcolcontains an object. - isSymbol(row, col): Determines if the specified cell at
rowandcolcontains a symbol.
Example
(hover over a cell to view its contents)
Note
- This example builds on the createQuadrille(jagged_array) approach—check it out to understand the foundation.
- Dynamic Quadrille Methods: The
cellTypeandcellValuemethods are appended to thequadrilleobject, allowing runtime customization without requiring subclasses. These methods leverage most of the cell content accessors discussed in this section (is*methods for type checking andread(row, col)for value retrieval, respectively).- Positioning in
displayCellDetails: Text positioning dynamically accounts for canvas centering and padding; abstracting this logic can simplify reuse.- Interactive Features: A checkbox toggles between displaying cell
typeorvalue, while thepulsefunction provides animated cell feedback.
14 pages
read(row, col)
isValid(row, col)
isEmpty(row, col)
isFilled(row, col)
isBoolean(row, col)
isNumber(row, col)
isBigInt(row, col)
isString(row, col)
isColor(row, col)
isImage(row, col)
isArray(row, col)
isFunction(row, col)
isObject(row, col)
isSymbol(row, col)
What this page's examples use
- p5.quadrille
drawQuadrillecreateQuadrillecellLengthmouseRowmouseColisValid- p5.js
createCanvasbackgroundcolorloadImagetextpositionfillcreateCheckboxcheckedheightnoStrokemapframeCountcirclesin- JavaScript
StringSymbol
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.