Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Object, Array utils
/**
* find index with key in array
* 배열속에 들어있는 객체의 값을찾는 함수
*
* @param {Array} array
* @param {String} key key name
* @param {String} search search value
* @return {Number}
*/
function findIndexWithKey(array=[], key='', search='')
{
for (let i=0; i<array.length; i++)
{
if (array[i][key] === search) return i;
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.