Subj : Re: Match getstr() to object
To : echicken
From : Ephram
Date : Thu Jun 04 2020 12:51 pm
> Re: Match getstr() to object
> By: Ephram to All on Thu Jun 04 2020 11:53:48
> Ep> var names = {
> Ep> AI:"Anguilla", ... };
> Ep> for(var i = 0; i <= names.length; i++) {
> 'names' is an Object, but you're treating it like an Array.
> You could try something like:
> for (var name in names) {
> // eg. name === 'AI' and names[name] === 'Anguilla'
> }
> Or something like:
> var keys = Object.keys(names);
> for (var i = 0; i < keys.length; i++) {
> // eg. keys[i] === 'AI' and names[keys[i]] === 'Anguilla'
> }
> Or something like:
> Object.keys(names).forEach(function (e) {
> // eg. e == 'AI' and names[e] === 'Anguilla'
> });
> echicken
Thank you, I appreciate that!
My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/
---
� Synchronet � Realm of Dispair BBS -
http://ephram.synchro.net:82