Results for “as”
Small, practical examples. Search by task or narrow things down below.
Replace an array segment in place
JavaScript: splice returns removed items and inserts replacements at the chosen position.
JavaScript✓ Tested
Replace one collection element
JavaScript: Update an existing element at a known valid index.
JavaScript✓ Tested
Replace text with parameter expansion
Bash Scripts: Replace text with parameter expansion with a small standalone Bash program.
Bash Scripts✓ Tested
Report partial success from multiple actions
Report partial success from multiple actions with a small React component and explicit browser behavior.
React✓ Tested
Require two conditions to be true
JavaScript: Combine a lower and an upper bound to check whether a value is in range.
JavaScript✓ Tested
Return a value through a named output variable
Bash Scripts: A Bash nameref can update a caller-supplied variable without command substitution.
Bash Scripts✓ Tested
Return an array through a nameref
Bash Scripts: Assign through a nameref to preserve array element boundaries.
Bash Scripts✓ Tested
Reverse a copy while preserving the original
JavaScript: Copy before reverse because reverse mutates the array it receives.
JavaScript✓ Tested
Run cleanup after a promise settles
JavaScript: finally runs after success or failure and normally preserves the original outcome.
JavaScript✓ Tested
Run your first program
JavaScript: Start with a complete program that prints one line. Follow the run instructions below.
JavaScript✓ Tested
Select a range of array elements
Bash Scripts: Quote a sliced at-sign expansion to keep each selected element separate.
Bash Scripts✓ Tested
Separate a first item from the remaining items
JavaScript: Array destructuring and a rest element produce named pieces of a sequence.
JavaScript✓ Tested