js 정리

[js]map key , value

const file = {}
const api = {}
const image = {}
fileRecords.forEach((res) => {
  file\[res.value\] = res.count
})
apiRecords.forEach((res) => {
  api\[res.value\] = res.count
})
imageRecords.forEach((res) => {
  image\[res.value\] = res.count
})
const re = {
  file: file,
  api: api,
  image: image
}

 

 

const result = {}
Object.keys(langList).forEach((key) => {
  result\[langList\[key\].value\] = {
    file: parseInt(langList\[key\].file),
    api: parseInt(langList\[key\].api),
    image: parseInt(langList\[key\].image)
  }
})

javascript null 체크 (ECMA6)

"dataIds": \[ null, null \]

if (rocord!== '' && rocord.id) {
  // 코드입력
}

Written by@MuseKim
Muse Kim