I am trying to use the optional chaining operator (?.) in my express app - it throws SyntaxError whenever I try.
if (user.address?.postal_code.length > 0 ) { ^ SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:1053:16) I have tried all variations:
user?.address?.postal_code?.length user?.address?.postal_code.length user?.address.postal_code.length "engines": { "node": "10.16.0", "npm": "6.9.0" }, "dependencies": { "body-parser": "^1.19.0", "express": "^4.17.1", ... } https://stackoverflow.com/questions/66676578/chaining-operator-throwing-error-in-express-app March 17, 2021 at 11:50PM
没有评论:
发表评论