Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Row 21 in index.js in animalfarm/server should not have ? after q? #4

Open
ComputerFrek opened this issue Aug 26, 2023 · 1 comment

Comments

@ComputerFrek
Copy link

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 ?

@Umang375
Copy link

Umang375 commented Sep 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants