N
N
Nikita NeVajno2019-10-25 16:13:11
JavaScript
Nikita NeVajno, 2019-10-25 16:13:11

Json.items[0] throws an error. Can you help?

Hello,
I'm making a bot for discord. I need help with this, when I request music from the bot, xs how to say "play music",
it only works on links, although it should also on names too. In the console it gives the following
" if (!json.items[0]) callback("3_-a9nVZYjk");"
^
https://imgur.com/a/hcLr20r
Knowledgeable people please help.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
2
2bllk, 2019-10-25
@Pangsit

The error says that the "items" field does not exist in the "json" object (in other words, items is undefined), so you can not access the element of the items field by index, because items does not exist (nothing good will come of it if Vasya tells Masha to get the ball with number 0 from the basket, which, according to him, is in front of her, but she, in fact, is not there, so there is nowhere to get the ball from).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question