Can we store an array within another array in javascript -
var locat = new Array();
-
var element = new Array();
-
locat[] = element;
-
or Can we use like this -
locat['name'][0] = "manoj";
-
locat['address'][1] = "Noida";
-
Please let me know the possible way
9 1905
Yes you can, but not the way you want, associative arrays doesn't exist in javascript, what you need is an array with objects inside.
I also recommend you the json syntax, is easier and cleaner.
Something like this: -
var locat = [
-
{'name':'manoj', 'address':'Noida'},
-
{'name':'some other name', 'address':'some other address'},
-
{'name':'etc...', 'address':'etc...'}
-
];
-
-
alert( locat[0].name ); //this will alert "manoj"
-
alert( locat[1].address ); //this will alert "some other address"
-
you don't need the quotation marks around the property names. -
var locat = [
-
{name:'manoj', address:'Noida'},
-
// ...
-
];
if you have many objects to insert, maybe consider using a constructor function.
regards
@Dormilich
You don't needed but it's reccomended, to reduce the load on the js engine, and semantically, anything without quotes in js tries to be parsed as a variable, that's why if you quote it, you avoid making the engine
do an extra unnecessary check.
Anyways, it's not like it will make the script crash if you don't use them ;)
I just use them whenever I feel so
@Dormilich
he was talking about JSON though, in which case you would.
double quotes too, not single quotes.
I don't know if Javascript will try to read it as object literal or JSON in the first place, thus the remark.
I have a web application , now I want to have IVR implementation , I will be using IVR which is a third party with my application.
Please guide me how should I start to integrate IVR with my application as my application will interac with my database.
Will I be rading and writing the response to the third party(IVR) ?
gits 5,390
Expert Mod 4TB
are you talking about something like this?
when we create index on tables , do the indexes gets cached or not by default.
Or we have to manually LOAD THE INDEXES INTO THE CACHE
gits 5,390
Expert Mod 4TB
please specify your question more clearly ... i guess! that you mean database-tables and in case you do you should post in the appropriate forum since this ... the current forum where you have posted it ... is the JavaScript-forum and doesn't deal with such kind of questions ...
kind regards,
MOD
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bob |
last post by:
I've tried everything; and I can't seem to get past this VERY
(seemingly) simply problem.
I want to work with an array variable within a function(s).
I can't get it to work; if I:
1) global...
|
by: WebRod |
last post by:
Hi,
see this code, i only set an array of array, then i copy this array in
another one, do an unset and display both:
$a=array("row1.1"=>"row1.1.1"
, "row1.2"=>"row1.2.1");
$a =...
|
by: John MacIntyre |
last post by:
Hi,
I have a page with a series of child pages loaded into an iframe. When I
move from page to page, I store an object containing the child's control
data in a variable on the main page, then...
|
by: Chris Haynes |
last post by:
Hello all,
I have a structure:
typedef struct UVstruct {
float u, v;
} uv;
Inside a function (A) i declare a pointer to an instance of this
structure:
|
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: jimbo |
last post by:
Here is my problem. I'm creating an Instrumentation class that will use
previously created Performance Categories and Counters in order to time
various processes (ie. query duration etc.). This...
|
by: Friday |
last post by:
Being an Old L.A.M.P guy, I beg you to please excuse my ignorance of
dot.net (and all things Windows, for that matter).
As part of an experiment (to learn enough ASP/VB.net to port a series
of ...
|
by: Eric A. Johnson |
last post by:
For the following code:
' return String representation of CTriangleShape
Public Overrides Function ToString() As String
' use MyBase reference to return CShape String
Return...
|
by: Leszek |
last post by:
Hi.
Is it possible in javascript to operate on an array without knowing how mamy
elements it has?
What i want to do is sending an array to a script, and this script should
add all values from...
|
by: bowlderster |
last post by:
Hello,all.
I want to get the array size in a function, and the array is an argument of the function.
I try the following code.
/***************************************
*/
#include<stdio.h>...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |