Object, Array utils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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