Object.keys ?

30 views
Skip to first unread message

Lee Goddard

unread,
May 14, 2012, 9:12:44 AM5/14/12
to mootool...@googlegroups.com
Hi all

I'm stuck, please help.

This line:
console.info( self.options.rules );

Renders:
Object { F="F[-FF]F[+FF]F"}

The very next line:
console.info( Object.keys( self.options.rules ) );

Renders:
[]

Have I over-looked something?

TIA!
Lee

Matthew Hazlett

unread,
May 14, 2012, 9:45:33 AM5/14/12
to mootool...@googlegroups.com
This is not enough information, please post a fiddle with all the
necessary code.

Lee

unread,
May 14, 2012, 9:49:04 AM5/14/12
to mootool...@googlegroups.com
Okay, Matthew - what more should I add?

As I read it, the console shows the value of an Object with one key, but
Object.keys doesn't show the key. Does that sound right?

Arian Stolwijk

unread,
May 14, 2012, 9:51:47 AM5/14/12
to mootool...@googlegroups.com

Object.keys only returns own properties, stuf in options are not own properties. If you really need the keys, you have to Object.clone it first.

Lee

unread,
May 14, 2012, 9:55:05 AM5/14/12
to mootool...@googlegroups.com
Ah, thanks Matthew - getting a fiddle ready revealed I had forgotten a
line in the class definition:

this.setOptions(options);

Cheers
Lee



On 14/05/2012 15:45, Matthew Hazlett wrote:

MrIsaacs

unread,
May 15, 2012, 10:22:09 AM5/15/12
to mootool...@googlegroups.com, l...@leegoddard.net
Object { F:"F[-FF]F[+FF]F"}

":" instead of "="
Reply all
Reply to author
Forward
0 new messages