Created
June 2, 2020 02:37
-
-
Save sonbyungjun/e6568c26c0884ce97c7283ac1c99968e to your computer and use it in GitHub Desktop.
Typescript(Javascript) Array Object Value Search Function (타입스크립트(자바스크립트) 배열 객체 값 검색 함수)
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
export function search(nameKey: any, myArray: any, attribute: string){ | |
for (let i=0; i < myArray.length; i++) { | |
if (myArray[i][attribute] === nameKey) { | |
return myArray[i]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment