0

I have following code,

let firstData = []

if (id) {
  const {
    data: firstData
  } = usedata(
    buyingSessionGroupId
  )
  firstData =
    firstData?.getdata?.datavalue ? ? []

  console.log("Data is ->", firstData)
}

console.log("Data are ->", firstData)

Now here logs are there in case of first block but after that in second it gives []. yes it is because of the let is a block scoped . So, Can any one help me with this ? Don't want to use the var

VLAZ
  • 26,331
  • 9
  • 49
  • 67
ganesh kaspate
  • 1
  • 9
  • 41
  • 88

0 Answers0