Skip to content

Instantly share code, notes, and snippets.

@sonbyungjun
Created June 2, 2020 02:37
Show Gist options
  • Save sonbyungjun/e6568c26c0884ce97c7283ac1c99968e to your computer and use it in GitHub Desktop.
Save sonbyungjun/e6568c26c0884ce97c7283ac1c99968e to your computer and use it in GitHub Desktop.
Typescript(Javascript) Array Object Value Search Function (타입스크립트(자바스크립트) 배열 객체 값 검색 함수)
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