FIND YOUR NEXT FEW LINES

Results for “Java”

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

257 snippets foundClear filters
JavaScriptArray traversal & selection

Check whether any item matches

JavaScript: some stops once a predicate succeeds.

JavaScript✓ Tested
JavaScriptArray traversal & selection

Check whether every item matches

JavaScript: every stops at the first failed predicate and returns true for an empty array.

JavaScript✓ Tested
JavaStrings

Check whether text contains a phrase

Use a case-sensitive Java substring check.

Java✓ Tested
JavaScriptText handling & Unicode

Check whether text ends with a suffix

JavaScript: Use endsWith for a literal case-sensitive ending.

JavaScript✓ Tested
JavaScriptText handling & Unicode

Check whether text starts with a prefix

JavaScript: Use startsWith for a literal case-sensitive prefix comparison.

JavaScript✓ Tested
JavaGetting Started

Choose between two branches

Java: Use if and else to handle an available or empty stock count.

Java✓ Tested
JavaScriptGetting Started

Choose between two branches

JavaScript: Use if and else to handle an available or empty stock count.

JavaScript✓ Tested
JavaScriptNumbers & numeric validation

Clamp a number between inclusive bounds

JavaScript: Combine Math.min and Math.max when lower is no greater than upper.

JavaScript✓ Tested
JavaScriptPromises & iteration protocols

Clean up a generator after an early break

JavaScript: Breaking a for-of loop closes a generator and runs its finally block.

JavaScript✓ Tested
JavaGetting Started

Combine text with a name

Java: Construct a greeting from a fixed prefix and a stored name.

Java✓ Tested
JavaScriptGetting Started

Combine text with a name

JavaScript: Construct a greeting from a fixed prefix and a stored name.

JavaScript✓ Tested
JavaGetting Started

Compare a value with a limit

Java: Turn a comparison into a readable yes or no result.

Java✓ Tested