how to fix Javascript unexpected token illegal

2019-08-31 04:08发布

问题:

I am getting an error in the following code on the first line:

if (typeof module != ‘undefined’ && module.exports) {
  module.exports = PushNotification;
}

This is the error:

I cannot seem to find the syntax error here. I am trying to use PushPlugin for iOS.

回答1:

It looks like you copy-pasted out of a rich text document and it inserted smart quotes:

‘undefined’

Replace them with regular quotes:

'undefined'