I would like to create a two dimensional array.
I would like an array where I can store 4 variables like (Artist, Track,
Album, Time) like per Element so I can access it later by element and
variable like:
var newVar = myArray[0].Artist
Would anybody know if it is possible and give me an example for the code.
Thanks
Max 3 3886
Max wrote: I would like to create a two dimensional array.
No, you would like to create an array of objects.
I would like an array where I can store 4 variables like (Artist, Track, Album, Time) like per Element so I can access it later by element and variable like:
// define the object prototype
function PlaylistItem(sArtist, sAlbum, sTrack, nTime)
{
this.artist = sArtist || "";
this.album = sAlbum || "";
this.track = sTrack || "";
this.time = nTime || -1;
}
// create array of PlaylistItem objects
var myArray = new Array(
new PlaylistItem(
"The Corrs",
"Unplugged",
"Lough Erin Shore",
4 + 25/60),
...);
var newVar = myArray[0].Artist
var newVar = myArray[0].artist;
HTH
PointedEars
On Fri, 7 Nov 2003 19:02:47 -0000
"Max" <ga*****@ntlworld.com> wrote:
<snip> ... so I can access it later...
<snip>
Later in the same script or later in the sense of persistence across
sessions?
--
Life is an offensive, directed against the repetitious mechanism of the
Universe.
--Alfred North Whitehead (1861-1947)
> I would like to create a two dimensional array. I would like an array where I can store 4 variables like (Artist, Track, Album, Time) like per Element so I can access it later by element and variable like:
var newVar = myArray[0].Artist
var myArray = [
{Artist: "Gut", Track: "Do the Gorilla", Album: "Songs in the Key of E",
Time: 3.5},
{Artist: "Gut", Track: "The Vision", Album: "Songs in the Key of E", Time:
3.65}]; http://www.JSON.org This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Parrot |
last post by:
I am trying to program a function to return a 2 dimensional array, but
it's not working. I reduced the return value to 1 dimension and
tested that to make sure that the problem wasn't elsewhere. ...
|
by: Luke Wu |
last post by:
Hello,
I'm having some problems understanding 2 dimensional arrays. My
problem relates to the following code:
#include <stdio.h>
#define M 3
#define N 3
|
by: truckaxle |
last post by:
I am trying to pass a slice from a larger 2-dimensional array to a
function that will work on a smaller region of the array space. The
code below is a distillation of what I am trying to...
|
by: Dadi |
last post by:
Hi,
I can make a simple initialization work like this:
Object ONE_ROW = {{"Vodafone", "5550160100197016"}};
But, now I want to create another array that consists of multiple copies of...
|
by: rguti |
last post by:
Hi,
How do I create a two dimensional array?
I have created a one dimensional doing this:
Dim laFields As ArrayList = New ArrayList
How about to do a 2 dimensional?
|
by: Diffident |
last post by:
Hello All,
I have a 2-dimensional array that I am storing as a session variable. I have
no idea on how I can cast the session variable back to 2-dimensional array.
Any pointers?
Reference...
|
by: entitledX |
last post by:
Hi, I'm trying to use the HDF library to read a few HDF files that I
need to process. The data in each file varies in rows, but the
columns remain constant. Because of that, I had dynamically...
|
by: spam.noam |
last post by:
Hello,
I discovered that I needed a small change to the Python grammar. I
would like to hear what you think about it.
In two lines:
Currently, the expression "x" is a syntax error.
I suggest...
|
by: per9000 |
last post by:
Hi all,
I have a two-dimensional array of data, f.x int's. We can imagine that
the array is "really large". Now I want the data in it and store this
in a one-dimensional array.
The obvious...
|
by: Peter Olcott |
last post by:
http://groups.google.com/group/comp.lang.c++/msg/a9092f0f6c9bf13a
I think that the operator() member function does not work correctly, does
anyone else know how to make a template for making two...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |