Is there an equivalent of “Array.None” in JS?

As logically concluded by the linq example

None is the same as !Any, so you could define your own extension method as follows:

let none = (arr, callback) => !arr.some(callback)

And then call like this:

let arr = ["a","b","c"]
let noBs = none(arr, el => el === "b")

Or if you want to extend Array.proto, you can add the following method:

Object.defineProperty(Array.prototype, 'none', {
    value: function (callback) { return !this.some(callback) }
});

Then call like this:

let arr = ["a","b","c"]
let noBs = arr.none(el => el === "b")

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)