0

I know that it does not make sense to be thinking about an obsolete browser but for the development that I am doing, I must provide support for it. My code works correctly in google chrome, but when I try it in internet explorer 9 I get this error:

SCRIPT1028: An identifier, string or number was expected 

What other syntax can I use to avoid it? thank you very much

nombresColumnas=["data0","data1","data2","data3"];

{
 [nombresColumnas[0]]: '#33E789',   //error here..!
 [nombresColumnas[1]]: '#00CCFF',
 [nombresColumnas[2]]: '#FFC33E',
 [nombresColumnas[3]]: '#384858'
}

output of last code:

{ "data0" : '#33E789'},
{ "data1": '#00CCFF'},
{ "data2": '#FFC33E'},
{ "data3": '#384858'}
yavg
  • 2,761
  • 7
  • 45
  • 115
  • 3
    IE does not support this ES6 syntax. You need to transpile. – SLaks May 02 '18 at 14:48
  • 1
    You will have to write like `obj[nombresColumnas[0]]='#33E789'` or loop the nombresColumnas – Joschi May 02 '18 at 14:49
  • what is @SLaks ?? – yavg May 02 '18 at 14:49
  • you are using EcmaScript 6 syntax, which is fairly recent. Internet Explorer 9 - which is not updated anymore, does not understand. EcmaScript is actually the language standard behind JavaScript. Transpile means transform from a language to another. – Pac0 May 02 '18 at 14:50
  • @Joschi what is obj?? – yavg May 02 '18 at 14:52

0 Answers0