JavaScript Express Basics Parameters, Query Strings, and Modularizing Routes Card Template

TypeError: 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];
Hakim Rachidi
Hakim Rachidi
37,992 Points

Hi 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;