RsD0p9BK
8/30/2017 - 4:28 AM

js__in_array.js

// How to check does value exists in array

function inArray(needle, haystack) {
    var length = haystack.length;
    for(var i = 0; i < length; i++) {
        if(haystack[i] == needle) return true;
    }
    return false;
}

// https://laracasts.com/discuss/channels/vue/how-to-check-does-value-exists-in-array-with-vue?page=1