Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28550

Re: function in hash

Newsgroups comp.lang.javascript
Date 2015-08-20 23:21 -0700
References <259c4391-a79d-43c9-b4f4-d6b3896ab9e3@googlegroups.com>
Message-ID <b458a4bb-90fb-43ef-96fb-2806bec85a23@googlegroups.com> (permalink)
Subject Re: function in hash
From Stone Zhong <stone.zhong@gmail.com>

Show all headers | View raw


On Thursday, August 20, 2015 at 11:20:26 PM UTC-7, Stone Zhong wrote:
> Hi there,
> 
> I wrote some code below (Format A) by mistake:
> 
> Format A:
> ------------------
> var a = {
>   x: 1,
>   y: 2,
>   foo() {
>     alert("foo");
>   },
> };
> 
> Actually I intend to write (Format B):
> 
> Format B:
> ------------------
> var a = {
>   x: 1,
>   y: 2,
>   foo: function() {
>     alert("foo");
>   },
> };
> 
> However, to my surprise, Format A works well in Firefox 38.2.0, I haven't tried other browser, am I missing anything? I thought Format A's syntax is wrong.
> 
> Thanks,
> Stone

Another ES5 black magic?

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

function in hash Stone Zhong <stone.zhong@gmail.com> - 2015-08-20 23:20 -0700
  Re: function in hash Stone Zhong <stone.zhong@gmail.com> - 2015-08-20 23:21 -0700
    Re: function in hash Andreas Bergmaier <andber93@web.de> - 2015-08-21 11:39 +0200
      Re: function in hash Stone Zhong <stone.zhong@gmail.com> - 2015-08-21 07:41 -0700

csiph-web