debug: {ping: true, query: false, srv: false, querymismatch: false, ipinsrv: false, …}
eula_blocked: false
ip: "45.146.253.38"
online: true
players: {online: 0, max: 20}
port: 2018
version: "1.20.1"
I want to filter out online: 0
and max: 20
using JavaScript.
(The array is stored in a variable and comes from an API).
EDIT: I found a way to filter the values out, but it somehow only works if I manually input my data, and not if I use the data from the variable of the API response:
const data = {
players:{online: 0,max: 20}
}
console.log("")
console.log("players online:", data.players.online)
console.log("players max: ", data.players.max)
This works with the const data
but not with the actual variable I want to work with, although it has the same structure. Why is that?