Skip to content

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

@ComputerFrek

Description

@ComputerFrek

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions