Skip to main content
1 of 4
ksav
  • 20.9k
  • 6
  • 52
  • 69

Check first if data.allItems[type] exists.

if(data.allItems[type] && data.allItems[type].length > 0){ ID = data.allItems[type][data.allItems[type].length - 1].id + 1; } else{ ID = 0; } 
ksav
  • 20.9k
  • 6
  • 52
  • 69