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ã
Sysop: | Karloch |
---|---|
Location: | Madrid, Spain |
Users: | 54 |
Nodes: | 8 (0 / 8) |
Uptime: | 129:14:53 |
Calls: | 700 |
Files: | 17,895 |
D/L today: |
128 files (60,769K bytes) |
Messages: | 66,010 |