You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Row 21 in index.js in animalfarm/server should not have ? after q?
Should be const q = req.query.q.toLowerCase() || '';
instead of const q = req.query.q?.toLowerCase() || '';
Error received below when running node .
`file:///mnt/c/Users//Documents/SourceCodes/animalfarm/server/index.js:21
const q = req.query.q?.toLowerCase() || '';
^
SyntaxError: Unexpected token '.'
at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
at async link (internal/modules/esm/module_job.js:42:21)`
Code works after removing ?
The text was updated successfully, but these errors were encountered:
It should work, there is nothing wrong in the const q = req.query.q?.toLowerCase() || ''; it would help if you share the entire code.
Maybe check the node version.
Row 21 in index.js in animalfarm/server should not have ? after q?
Should be
const q = req.query.q.toLowerCase() || '';
instead of
const q = req.query.q?.toLowerCase() || '';
Error received below when running
node .
`file:///mnt/c/Users//Documents/SourceCodes/animalfarm/server/index.js:21
const q = req.query.q?.toLowerCase() || '';
^
SyntaxError: Unexpected token '.'
at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
at async link (internal/modules/esm/module_job.js:42:21)`
Code works after removing ?
The text was updated successfully, but these errors were encountered: