web/javascript

callBack - for

내가 만드는게 길이 된다 2026. 1. 14. 22:01

const getDesc = searchKey => {
return new Promise(resolve => {
  fetch('http://localhost/?apiKey=123&parm='${searchKey}')
  .then(res => res.json)
  .then(json => resolve(json))
});
}

let arr = ["aa", "bb", "cc"];
//forEach 사용말것,

//순서대로
const descProc = async () => {
for(let data of arr){
  let desc = await getDesc("tb_table");
  console.log(data, desc);
}
}

'web > javascript' 카테고리의 다른 글

fetch - 옵션  (0) 2026.01.14
fetch  (0) 2026.01.14
callBack - for  (0) 2026.01.14
callBack - fetch  (0) 2026.01.14
callBack - Reject  (0) 2026.01.13