I had some issues to get a website working in Internet Explorer (IE9) and I found that we have defined a function in a javascript object in the following way:
var test = {
a : function(){alert(123);},
blafasl(){$("#test").text("456");},
b : function(){alert(678);},
}
test.blafasl();
//test.b();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='test'></div>
In Chrome and Firefox the code is working but in IE9 it produces an error message.
Is the definition of 'blafasl' valid (and how does it work)? Or is it correct that the IE comes up with an error?
It works in Chrome, Firefox and IE when I change the blafasl definition to:
blafasl: function(){....},
I found this: http://www.bryanbraun.com/2014/11/27/every-possible-way-to-define-a-javascript-function but it does not cover my Question...
Greetings Martin
PS: Here is a fiddel of the above code: http://jsfiddle.net/zjobwd89/2/