![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
: function anObject( a, b, c) : { : this.a = a : this.b = b : this.c = c : } Thanks Aaron, I tried this method before but I missed using the "this." It's very important. Yes it works great. |


#4
| |||
| |||
|
#5
| |||
| |||
|
|
Hi there, I tried to create a meaningful data structure in JavaScript, and I didn't seem to be able to find the right syntax or perhaps this is not supported: The only thing I can come up with is not nice but it's working: EX: sqldata = new Array(1..n); or MaxElement = 12; sqldata = new Array(Array(1..n1), Array(1..n2), MaxElement) ; So to subscribe/view MaxElement, I have to do something like this: sqldata[2] Instead of: sqldata.MaxElement Using enum is not accepted in Javascript. Any one knows a different way I can try? Using a Class didn't seem to work neither. Thanks for your suggestion. |
#6
| |||
| |||
|
|
Hi there, I tried to create a meaningful data structure in JavaScript, and I didn't seem to be able to find the right syntax or perhaps this is not supported: The only thing I can come up with is not nice but it's working: EX: sqldata = new Array(1..n); or MaxElement = 12; sqldata = new Array(Array(1..n1), Array(1..n2), MaxElement) ; So to subscribe/view MaxElement, I have to do something like this: sqldata[2] Instead of: sqldata.MaxElement Using enum is not accepted in Javascript. Any one knows a different way I can try? Using a Class didn't seem to work neither. Thanks for your suggestion. |
#7
| |||
| |||
|
|
Hi there, I tried to create a meaningful data structure in JavaScript, and I didn't seem to be able to find the right syntax or perhaps this is not supported: |
|
Try this: Drop this function into your code somewhere. Array.prototype.MaxElm = function() { return this[this.length-1]; } Then do sqldata.MaxElm();, which will return the last element in the array. In fact, any array in any page where you have that code. |
#8
| |||
| |||
|
|
Dr.Tulip took the time to say: Hi there, I tried to create a meaningful data structure in JavaScript, and I didn't seem to be able to find the right syntax or perhaps this is not supported: (top-posting corrected) My Pet Programmer wrote: Try this: Drop this function into your code somewhere. Array.prototype.MaxElm = function() { return this[this.length-1]; } Then do sqldata.MaxElm();, which will return the last element in the array. In fact, any array in any page where you have that code. Why did you post this to a Java newsgroup, let alone one that is nearly unused? |
#9
| |||
| |||
|
|
I just replied to another message, and didn't realize the Java newsgroup was cc'd. Apologies, won't happen again. ~A! Lew took the time to say: Dr.Tulip took the time to say: Hi there, I tried to create a meaningful data structure in JavaScript, and I didn't seem to be able to find the right syntax or perhaps this is not supported: (top-posting corrected) My Pet Programmer wrote: Try this: Drop this function into your code somewhere. Array.prototype.MaxElm = function() { return this[this.length-1]; } Then do sqldata.MaxElm();, which will return the last element in the array. In fact, any array in any page where you have that code. Why did you post this to a Java newsgroup, let alone one that is nearly unused? Just one last reply to let everyone know I'm sorry about the top |
#10
| |||
| |||
|
|
My Pet Programmer took the time to say: I just replied to another message, and didn't realize the Java newsgroup was cc'd. Apologies, won't happen again. ~A! Lew took the time to say: Dr.Tulip took the time to say: Hi there, I tried to create a meaningful data structure in JavaScript, and I didn't seem to be able to find the right syntax or perhaps this is not supported: (top-posting corrected) My Pet Programmer wrote: Try this: Drop this function into your code somewhere. Array.prototype.MaxElm = function() { return this[this.length-1]; } Then do sqldata.MaxElm();, which will return the last element in the array. In fact, any array in any page where you have that code. Why did you post this to a Java newsgroup, let alone one that is nearly unused? Just one last reply to let everyone know I'm sorry about the top posting, haven't been here long. |
![]() |
| Thread Tools | |
| Display Modes | |
| |