Results for “Event control”
Small, practical examples. Search by task or narrow things down below.
Provide a fallback for a nullable value
C#: The null-coalescing operator supplies a default only when the left side is null.
C#✓ Tested
Read a data attribute from the current target
Read a data attribute from the current target with a small React component and explicit browser behavior.
React✓ Tested
Read a DOM element through a viewChild signal
Read a DOM element through a viewChild signal with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Remove a list item by identifier
Remove a list item by identifier with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Render groups with nested loops
Render groups with nested loops with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Render untrusted-looking input as literal text
Render untrusted-looking input as literal text with a small React component and explicit browser behavior.
React✓ Tested
Return a value from a switch expression
Java: Use an exhaustive switch expression with a fallback for other input values.
Java✓ Tested
Return multiple named values from a method
C#: Named value tuples give lightweight field names without a separate class.
C#✓ Tested
Run a task on an executor and close it
Java: Java 21 ExecutorService supports try-with-resources to shut down after submitted work.
Java✓ Tested
Run cleanup after a handled exception
Java: A finally block executes whether the protected operation succeeds or fails.
Java✓ Tested
Sort a derived copy of a collection
Sort a derived copy of a collection with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Stop a nested click from reaching its parent
Stop a nested click from reaching its parent with a standalone Angular component and explicit browser behavior.
Angular✓ Tested