IE11 and JavaScript

JackTheKnife Source

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


instead of commas.

Documentation says that IE support fully map since IE9

Any clue on that?



answered 4 months ago obermillerk #1

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,]

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,]; }

comments powered by Disqus