FIND YOUR NEXT FEW LINES

Results for “Object behavior & collections”

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

631 snippets foundClear filters
jQueryForm serialization & state

Restore a form’s original default values

jQuery: Call the native reset method through the underlying form element.

jQuery✓ Tested
ReactEffects & lifecycle

Restore the previous document title

Restore the previous document title with a small React component and explicit browser behavior.

React✓ Tested
PythonStructured data & serialization

Return a small immutable named record

Python: Use NamedTuple when callers need both tuple behavior and named fields.

Python✓ Tested
HTMLNative disclosure & dialogs

Return a value from a dialog form

HTML: A form with method dialog closes its containing dialog without a network submission.

HTML✓ Tested
jQueryTraversal & selection

Return to the previous collection in a chain

jQuery: end restores the selection before the last traversal operation.

jQuery✓ Tested
ReactCustom hooks

Reuse controlled-input bindings

Reuse controlled-input bindings with a small React component and explicit browser behavior.

React✓ Tested
ReactCustom hooks

Reuse document-title synchronization

Reuse document-title synchronization with a small React component and explicit browser behavior.

React✓ Tested
ReactCustom hooks

Reuse event subscription cleanup

Reuse event subscription cleanup with a small React component and explicit browser behavior.

React✓ Tested
jQueryAnimation completion

Reveal a collapsed panel with a slide

jQuery: slideDown animates the panel’s vertical dimensions.

jQuery✓ Tested
C#Dates & precise numbers

Round a decimal using an explicit midpoint rule

C#: Use decimal literals for decimal arithmetic and choose the midpoint rounding behavior.

C#✓ Tested
jQueryHTTP requests

Run cleanup after an AJAX failure

jQuery: always runs on success or failure and can clear loading state.

jQuery✓ Tested
C++Ownership & optional values

Run cleanup through a scoped destructor

C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.

C++✓ Tested