Results for “own”
Small, practical examples. Search by task or narrow things down below.
Distinguish an own property from an inherited one
JavaScript: Object.hasOwn avoids depending on an object’s possibly shadowed hasOwnProperty method.
JavaScript✓ Tested
Distinguish an own property from an inherited one
TypeScript: Object.hasOwn avoids depending on an object’s possibly shadowed hasOwnProperty method.
TypeScript✓ Tested
Extract a known substring
PowerShell: Substring uses a zero-based starting index and a character count.
PowerShell✓ Tested
Extract text between known positions
Java: Java substring uses a start-inclusive, end-exclusive range of UTF-16 indices.
Java✓ Tested
Format a known timestamp in UTC
C: gmtime converts to UTC calendar fields and strftime formats them.
C✓ Tested
Format a known UTC timestamp
Linux Commands: Use GNU date -u and an explicit input offset to avoid local timezone dependence.
Linux Commands✓ Tested
Format an integer into a caller-owned buffer
C++: to_chars avoids allocation and reports whether the buffer was large enough.
C++✓ Tested
Give a function its own positional parameters
Bash Scripts: A function receives its call arguments without replacing the caller’s positional parameters.
Bash Scripts✓ Tested
List an object’s own enumerable keys
JavaScript: Object.keys omits inherited and non-enumerable properties.
JavaScript✓ Tested
List an object’s own enumerable keys
TypeScript: Object.keys omits inherited and non-enumerable properties.
TypeScript✓ Tested
Make a script executable by its owner
Linux Commands: Add the owner execute bit without replacing all permission bits.
Linux Commands✓ Tested
Match a known text prefix
SQL: A percent wildcard matches zero or more characters following the prefix.
SQL✓ Tested