Results for “Array operations”
Small, practical examples. Search by task or narrow things down below.
Transform a collection into a plain array
jQuery: map followed by get returns ordinary JavaScript values.
jQuery✓ Tested
Transform array values
Use map to create a JavaScript array of squared values.
JavaScript✓ Tested
Update one array item by its identifier
Update one array item by its identifier with a small React component and explicit browser behavior.
React✓ Tested
Visit every reading in a fixed array
Arduino / C: Visit every reading in a fixed array on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested
Add calendar days in UTC
JavaScript: Use UTC date setters to cross month boundaries without local daylight-saving effects.
JavaScript✓ Tested
Add calendar days in UTC
TypeScript: Use UTC date setters to cross month boundaries without local daylight-saving effects.
TypeScript✓ Tested
Advance an index around a fixed collection
Arduino / C: Modulo wraps a bounded nonnegative index to zero.
Arduino / C✓ Tested
Append a dynamic form control
Append a dynamic form control with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Append a line while keeping earlier content
PowerShell: Add-Content appends using an explicitly selected encoding.
PowerShell✓ Tested
Average a fixed set of readings
Accumulate sample values without overflowing a 16-bit total.
array✓ Tested
Calculate a cumulative sum for each position
C: Keep a running total and store each prefix result in a separate output array.
C✓ Tested
Calculate a file’s SHA-256 digest
PowerShell: Get-FileHash hashes bytes without requiring the caller to load the whole file.
PowerShell✓ Tested