Below code not working in IE. Console shows syntax error. Whats wrong with this?
var text = '{"products":[' +
'{"name":"IB-400","mail":"9000@mail.pl"},' +
'{"name":"IB-500","mail":"8000@mail.pl"}]}';
var textObj = JSON.parse(text)
var mail = textObj.products.find(itm => itm.name == c).mail
$( ".komunikat" ).replaceWith( '<div class="komunikat-mail"><h1 style="text-align:center;">Contact</h1><p class="komunikat-paragraph">Lorem ipsum ' + mail +'. Lorem ipsum.</p></div>' );
They syntax error is because you're using an arrow function in a browser that doesn't support them.
Change itm => itm.name == c
to function ( itm ) { return itm.name == c }
.
or use Babel to transpile ES6 to ES5 for you.