var promi = (param) => new Promise(res => {
setTimeout(() => {
console.log(param)
res(param + 1)
}, 1000)
})
//방법1
promi(1)
.then((data) => promi(data))
.then((data) => promi(data))
//방법2
promi(1)
.then((data) => {
promi(data)
})
.then((data) => {
promi(data)
})
방법 1은 원하는데로 1초씩 걸려서 출력하는데
방법 2로 하면 1,2까진 제대로 출력되는데 data 못받아오고 바로 undifined로 출력되는데
arrow function에서 중괄호하고 안하고가 뭔 차이가 있는건가요?