Results for “cr”
Small, practical examples. Search by task or narrow things down below.
Count down with a while loop
Bash Scripts: Count down with a while loop with a small standalone Bash program.
Bash Scripts✓ Tested
Count the elements in an array
Bash Scripts: The array length form counts assigned elements, not characters in the first value.
Bash Scripts✓ Tested
Count the items in a collection
JavaScript: Read the collection’s length instead of hard-coding the loop limit.
JavaScript✓ Tested
Count the items in a collection
TypeScript: Read the collection’s length instead of hard-coding the loop limit.
TypeScript✓ Tested
Count Unicode code points in a string
JavaScript: String iteration combines surrogate pairs, unlike the UTF-16 length property.
JavaScript✓ Tested
Count Unicode code points in a string
TypeScript: String iteration combines surrogate pairs, unlike the UTF-16 length property.
TypeScript✓ Tested
Declare a fixed configuration value
Bash Scripts: Declare a fixed configuration value with a small standalone Bash program.
Bash Scripts✓ Tested
Decode a percent-encoded URL component
JavaScript: decodeURIComponent reverses percent encoding and throws for malformed sequences.
JavaScript✓ Tested
Decode a percent-encoded URL component
TypeScript: decodeURIComponent reverses percent encoding and throws for malformed sequences.
TypeScript✓ Tested
Define and call a shell function
Bash Scripts: Define and call a shell function with a small standalone Bash program.
Bash Scripts✓ Tested
Delegate iteration to another iterable
JavaScript: yield-star forwards items from another iterable while retaining generator composition.
JavaScript✓ Tested
Delegate iteration to another iterable
TypeScript: yield-star forwards items from another iterable while retaining generator composition.
TypeScript✓ Tested