some

Summary

Tests if the specified condition is valid for at least one array element.

Signatures

Click on a signature to select it and view its documentation.

Usage

public bool some(bool(T currentValue) callback)

Returns

true if at least one array element satisfies the specified condition and false otherwise.

Parameters

callback

A function which provides the test logic.

Description

Tests if the specified condition is valid for at least one array element.

This method was standardized in ECMAScript 5 for JavaScript. For web browsers that do not support ECMAScript 5, JS++ will provide a polyfill for this method only if it is used.

Examples

Basic Usage
1
2
3
4
5
6
7
import System;
 
int[] numbers = [ 2, 3, 4, 6, 8, 10 ];
bool containsOdd = numbers.some(bool(int currentValue) {
    return currentValue % 2 == 1;
});
Console.log(containsOdd); // true

Share

HTML | BBCode | Direct Link