Jump to content

Javascript Array Notation


toreachdeepak
 Share

Recommended Posts

It's an Object. You access an object property with a dot '.':

alert(oContextMenuItems.tdclass01);

What's written in your code is equivalent to this:

var oContextMenuItems = new Object();oContextMenuItems.tdclass01 = new Array();oContextMenuItems.tdclass01[0] = "Edit Row0,Column1";oContextMenuItems.tdclass01[1] = "Cancel Row0,Column1";

You don't need quotes around the property name. You could write it like this:

var oContextMenuItems = { tdclass01:[ "Edit Row0,Column1", "Cancel Row0,Column1" ]}
Edited by Ingolme
Link to comment
Share on other sites

It's an Object. You access an object property with a dot '.':
alert(oContextMenuItems.tdclass01);

What's written in your code is equivalent to this:

var oContextMenuItems = new Object();oContextMenuItems.tdclass01 = new Array();oContextMenuItems.tdclass01[0] = "Edit Row0,Column1";oContextMenuItems.tdclass01[1] = "Cancel Row0,Column1";

You don't need quotes around the property name. You could write it like this:

ThanksDeepak
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...