Skip to content
Advertisement

SyntaxError: Unexpected token

I am using MongoDB + Node.js to create an app, but I am receiving an error for this code:

company.js

JavaScript

api.js

JavaScript

Error

friends.name: req.body.friendName,

SyntaxError: Unexpected token .

I also tried with friend[‘name’] but the result was the same: SyntaxError: Unexpected token [

Please tell me where is my mistake

Advertisement

Answer

Try:

JavaScript

or:

JavaScript

depend on what you’re after.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement