Ex:
{
  "123": [
     ...stuff
  ]
}
How do I call "123" in a jquery without returning an error?
I've tried:
$.getJSON('insert-url-here').then(function (data) {
  console.log(data.123.length)
}
but it doesn't work.
Ex:
{
  "123": [
     ...stuff
  ]
}
How do I call "123" in a jquery without returning an error?
I've tried:
$.getJSON('insert-url-here').then(function (data) {
  console.log(data.123.length)
}
but it doesn't work.
 
    
     
    
    Use square bracket notation:
const data = {
  "123": [1, 2, 3]
}
console.log(data[123].length);Or since it's technically a string:
const data = {
  "123": [1, 2, 3]
}
console.log(data["123"].length);