1

I have run into problem under IE11. It throws an error

Expected: ":"

for that line of code:

this.aAttachments = MessageStore.message().attachments().map(({fileName,mimeType,fileType,fileNameExt,download}) => [fileName,mimeType,fileType,fileNameExt,download]);

in the part

{fileName,mimeType,fileType,fileNameExt,download}

instead of commas.

Documentation says that IE support fully map since IE9

Any clue on that?

5
  • The question is, does MessageStore.message().attachments() return an Array or an "array-like" object? In IE, you can only call .map() on true arrays, not "array-like" objects. If the return value is an array-like object, you'll need to explicitly convert it to an Array with Array.prototype.slice.call(MessageStore.message().attachments()). Commented Jun 13, 2018 at 21:20
  • 2
    Imho the destructuring is more a problem. IE has no support for even basic destructuring. Btw the error message already hints at that, it expects a : for a key:value pair because it's the only thing the parser could possibly expect. Commented Jun 13, 2018 at 21:20
  • @ScottMarcus it returns an array of objects like [{key:value, key1:value},{key:value, key1:value},...] Commented Jun 13, 2018 at 21:22
  • 2
    As a currently deleted (for different reasons) answer stated: IE doesnt even support arrow functions. Poor souls who have to support IE11 or even lower, really. I hope i never ever have to. Commented Jun 13, 2018 at 21:37
  • You should use a transpiler. Commented Jun 18, 2018 at 14:39

1 Answer 1

4

I don't think the issue is with map, I think the issue is that you're using a shortcut for assigning object properties to their own variables in that part you specified. I believe this is a relatively new feature to javascript so likely not supported by IE since it seems to lag far behind. I would suggest changing your inline function to

(obj) => [obj.fileName,obj.mimeType,obj.fileType,obj.fileNameExt,obj.download]

and see if that fixes it.

EDIT: Some people are also saying that IE does not support arrow functions either, so make that

function(obj) { return [obj.fileName,obj.mimeType,obj.fileType,obj.fileNameExt,obj.download]; }
Sign up to request clarification or add additional context in comments.

2 Comments

IE doesn't support arrow functions, either, you need function(obj)
Looks promising when running on standalone IE11. I will verify how it comes when IE11 is emended in the main application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.