Skip to content

search needle in array javascript - Partially string search array of javascript for a needle

Notifications You must be signed in to change notification settings

MostafaRostami72/in-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

in array needle in javascript

in_array = (needle, array) => {
    let length = array.length;

    for (let i = 0; i < length; i++) {
        if (array[i] == needle) return true;
    }

    return false;
}

const arr = [1,2,3,4];


in_array(2,arr) // Output true

About

search needle in array javascript - Partially string search array of javascript for a needle

Resources

Stars

Watchers

Forks