S
S
Sanders Rocket2020-04-29 22:26:07
JavaScript
Sanders Rocket, 2020-04-29 22:26:07

How to get dynamic information from an array?

Ac9AUcA.png
We have an array above, how to get the contents of member_id from it, given that it is always different

if (msg.message.action.type === "chat_kick_user"){
      console.log(msg.message.action)
      const autokick = msg.message.action.Object
      console.log(autokick)
      kicks(msg.message.peer_id, autokick)
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lazuren, 2020-04-29
@lazuren

Apparently it's not an array, but an object.
Each time it is created or updated, display the value by key.
Object.member_id where Object is the name of your "array" object.

A
Andrey Pike, 2020-04-29
@AndyPike

Yes, it's an object, not an array.
Show more code, I don't understand.
Mutation tracking is only done through a layer of getters/setters, and VanillaJS does not.
If there is nothing to lose, you can store the state of the object locally, in the form of a clone.
And check through setInterval.
But this is a very tricky solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question