FIND YOUR NEXT FEW LINES

Results for “Types & reliable control flow”

Small, practical examples. Search by task or narrow things down below.

308 snippets foundClear filters
TypeScriptRegular expressions & URL encoding

Read named regex capture groups

TypeScript: Named groups make a fixed input format easier to inspect than numeric group positions.

TypeScript✓ Tested
TypeScriptGetting Started

Read one character from ASCII text

TypeScript: Use a valid zero-based index to read the first character.

TypeScript✓ Tested
TypeScriptGetting Started

Read the beginning of a text value

TypeScript: Extract or display the first three ASCII characters from a known nonempty string.

TypeScript✓ Tested
TypeScriptArray traversal & selection

Read the final array item with a negative index

TypeScript: at supports negative positions counted from the end.

TypeScript✓ Tested
TypeScriptGetting Started

Read the first collection element

TypeScript: Access index zero only after establishing that the collection is nonempty.

TypeScript✓ Tested
TypeScriptPromises & iteration protocols

Recover from an expected promise rejection

TypeScript: Return a fallback from catch so later handlers receive an ordinary resolved value.

TypeScript✓ Tested
CSSBox dimensions & overflow

Remove a hidden element’s layout space

CSS: Display none removes a box from layout as well as hiding its contents.

CSS✓ Tested
TypeScriptObject behavior & collections

Remove a Map entry and detect whether it existed

TypeScript: Map.delete returns true only when an entry was present.

TypeScript✓ Tested
jQueryEvent control

Remove one handler without removing others

jQuery: Pass the original function reference to off.

jQuery✓ Tested
jQueryEvent control

Remove related events by namespace

jQuery: Namespaced events let a feature clean up its own handlers.

jQuery✓ Tested
TypeScriptRegular expressions & URL encoding

Reorder captured text in a replacement

TypeScript: Use numbered replacement groups to rearrange a known two-part name.

TypeScript✓ Tested
TypeScriptGetting Started

Repeat a fixed number of times

TypeScript: Use a counted loop to print three numbered steps.

TypeScript✓ Tested