Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDennis Mwangi
6,835 PointsTypeError: Cannot destructure property `text` of 'undefined' or 'null'.
my req.query is a null
const {side} = req.query;
const {id} = req.params;
const {text} = cards[id][side];
const {hint} = cards[id];
1 Answer
Hakim Rachidi
38,490 PointsHi Dennis,
Node wants to say that something went wrong during the destruction of the cards[id][side] variable.
- cards[id][side] is undefined.
This may be due to the following:
- cards is null
- id or side did not contain the expected value so the value of the property is undefinied
You can use a debugger to find out more about the state of your variables and your program when it's running.
Hope this helps;