Hi,
A have an array of objects defined like this:
var collegas =
[{smtp:'a***************@king.dom',voornaam:'Alberi c',famnaam:'Verhelst'},
{smtp:'a************@king.dom',voornaam:'Anita',fa mnaam:'Dierens'}, etc
I iterate over this array with this code :
for (var i = 0, stop=collegas.length ; i < stop ; i++) {
for (var veld in collegas[i]) {
etc
I would like to check whether a particular veld instance's name is smtp. In
code what I want is this :
if (veld.fieldName=="smtp") { do something ...
But this syntax doesn't work.
Any help much appreciated.
Ward 2 1140
Ward <ki**********@forpresident.com> wrote in
news:Xn**********************************@195.130. 132.70: Hi,
A have an array of objects defined like this:
var collegas = [{smtp:'a***************@king.dom',voornaam:'Alberi c',famnaam:'Verhelst '}, {smtp:'a************@king.dom',voornaam:'Anita',fa mnaam:'Dierens'}, etc
I iterate over this array with this code :
for (var i = 0, stop=collegas.length ; i < stop ; i++) { for (var veld in collegas[i]) { etc
I would like to check whether a particular veld instance's name is smtp. In code what I want is this : if (veld.fieldName=="smtp") { do something ...
But this syntax doesn't work.
Any help much appreciated.
Ward
I was sleeping awake.
if (veld=="smtp") was what i was looking for..
regards,
Ward
Ward said on 13/04/2006 8:10 AM AEST: Ward <ki**********@forpresident.com> wrote in news:Xn**********************************@195.130. 132.70:
Hi,
A have an array of objects defined like this:
var collegas = [{smtp:'a***************@king.dom',voornaam:'Alberi c',famnaam:'Verhelst '}, {smtp:'a************@king.dom',voornaam:'Anita', famnaam:'Dierens'}, etc
I iterate over this array with this code :
for (var i = 0, stop=collegas.length ; i < stop ; i++) { for (var veld in collegas[i]) { etc
I would like to check whether a particular veld instance's name is smtp. In code what I want is this : if (veld.fieldName=="smtp") { do something ...
But this syntax doesn't work.
Any help much appreciated.
Ward I was sleeping awake. if (veld=="smtp") was what i was looking for..
You can also do:
if ( smtp in collegas[i] ){
// collegas[i] has an element [i]
// with a property called 'smtp'
}
Depending on what the value of the property is set to, it might be OK to
use:
if ( collegas[i].smtp ) {
//...
}
Noting that if the property exists but its value equates to boolean
false (say it's set to the number zero) the test will return false.
--
Rob
Group FAQ: <URL:http://www.jibbering.com/FAQ> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Josep |
last post by:
Hi,
I'd like to poll a database and get the table contents, as well as the field
names from that table. I've been to php.net but this time I cannot find
something helpful.
I can get the data,...
|
by: |
last post by:
How do I get to the fieldnames of a table in a recordset?
I have a recordset which I output into HTML.
And on data from certian columns I need to perform different actions.
I would like to...
|
by: Little PussyCat |
last post by:
Hello,
I have had a request, one of our tables is used as a report and I have been
asked that all fieldnames for months have dashes in them,
like Jan-05 instead of Jan05 and so on...
Now what...
|
by: phpcode |
last post by:
I have a javascript function as follows:
function myfunction(formName,formField) {
parseInt(document.formName.formField.value) +=1;
}
Then I can call the function when needed like this:
...
|
by: mrgr8avill |
last post by:
Hello, all.
First off, I apologize for my ignorance. I am not used to working with non-variants, and it has been a LONG time since
I dealt with OOP.
I need to pass a string to a compiled...
|
by: Jay Balapa |
last post by:
Hello,
Iam creating a query page, in which a Drop Down List will have collection of
fieldnames.
Is there a elegant way of doing it?
Currently Iam opening up a datareader and using...
|
by: Beren |
last post by:
Hello,
I have an sproc to query a couple of tables, that have the same fieldnames,
for example DateCreated.
-------------------------------------
Select a.* , b.* From tablea a
Join table b...
|
by: Miles Keaton |
last post by:
Is there a simple way to list fieldnames in a table, from PHP?
When on the command-line, I just do \d tablename
But how to get the fieldnames from PHP commands?
...
|
by: Gerrit |
last post by:
Hello,
I try to display the fieldnames and the primary key of a table, with this
code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using...
|
by: john |
last post by:
In the query builder I made an edit-query in which I have linked table A to
table B on IDnr. For every record that matches I want 5 fields of table A to
get the values of corresponding fields in...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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: 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: 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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |