Results for “cr”
Small, practical examples. Search by task or narrow things down below.
Drop the fractional part toward zero
JavaScript: Math.trunc differs from floor for negative inputs.
JavaScript✓ Tested
Drop the fractional part toward zero
TypeScript: Math.trunc differs from floor for negative inputs.
TypeScript✓ Tested
Explain a calculation with a comment
JavaScript: Keep the code executable while documenting why a fixed input is used.
JavaScript✓ Tested
Explain a calculation with a comment
TypeScript: Keep the code executable while documenting why a fixed input is used.
TypeScript✓ Tested
Export a value to child processes
Bash Scripts: Only exported shell variables are inherited through the environment.
Bash Scripts✓ Tested
Extract a basename without an external process
Bash Scripts: Double hash removes the longest matching prefix ending in a slash.
Bash Scripts✓ Tested
Extract a parent path with parameter expansion
Bash Scripts: Percent removes the shortest matching slash-and-suffix portion.
Bash Scripts✓ Tested
Extract a substring by offset and length
Bash Scripts: Bash substring offsets start at zero for an ordinary string.
Bash Scripts✓ Tested
Extract all regex matches with their groups
JavaScript: matchAll requires a global regular expression and returns an iterator of matches.
JavaScript✓ Tested
Extract all regex matches with their groups
TypeScript: matchAll requires a global regular expression and returns an iterator of matches.
TypeScript✓ Tested
Extract text by start and end positions
JavaScript: String slice uses an inclusive start and exclusive end measured in UTF-16 code units.
JavaScript✓ Tested
Extract text by start and end positions
TypeScript: String slice uses an inclusive start and exclusive end measured in UTF-16 code units.
TypeScript✓ Tested