400 reputation
37
bio website rocha.la
location London, United Kingdom
age
visits member for 4 years, 2 months
seen Nov 22 at 8:28

JavaScript developer, front-end enthusiast, geek


Sep
24
awarded  Autobiographer
Nov
28
comment Disadvantages to using “associative arrays” in JavaScript
No, I get it, that's why I'm arguing that Array is just not the right object to start with if it doesn't offer any benefits.
Nov
25
comment Disadvantages to using “associative arrays” in JavaScript
Also to the second point, assuming array is used as it's supposed to be, to retrieve item from an array you have to provide index, not the key. If you don't know the index of your item, you can't retrieve it with a single lookup hence {} is best for storing properties this way.
Nov
25
comment Disadvantages to using “associative arrays” in JavaScript
@Doorknob You're right about the array props - they're obviously not visible in the loop, thanks for that. With the second one - yes, but that's not the point. Even thought array methods are not available in for loop, you can still get and set them with, ex. array['push'] but why would you use it this way? It's just bad practice and doesn't offer you anything apart from confusion. Say I had var drinktypes = new Array(), and then set drinktypes['pop'] = 'cola'; . see, I just broke an array. There is absolutely no benefit to use Array in this manner as normal {} would do.
Nov
25
revised Disadvantages to using “associative arrays” in JavaScript
added 87 characters in body
Nov
22
revised Disadvantages to using “associative arrays” in JavaScript
edited body
Nov
22
comment Disadvantages to using “associative arrays” in JavaScript
@AndyLester, thomas raised valid concern questioning the method that is clearly wrong. I'm not sure where you're going with your comment.
Nov
22
answered Disadvantages to using “associative arrays” in JavaScript
Nov
18
comment Real-World node.js
Thanks Robert, very informative article!
Oct
24
comment Real-World node.js
'immediately spinning each request off onto its own new thread' - that's not true at all. Single Node process has only one thread, and what happens is that all operations are added to the event queue. Once the only available thread is free, it picks up another job from that queue. That's why we're using callbacks everywhere - node will eventually get to that operation somewhere in the queue and once done the callback will return the result.
Feb
25
awarded  Constituent
Feb
25
comment Does it make sense and is it to acceptable to say “.NET code”?
not sure how that helps the OP
Feb
18
awarded  Caucus
Jan
15
awarded  Critic
Jan
9
awarded  Editor
Jan
9
revised Should your best programmers have to check everyone else's code into source control?
deleted 1 characters in body
Jan
8
answered Should your best programmers have to check everyone else's code into source control?
Sep
18
awarded  Yearling
Jan
11
awarded  Good Answer
Oct
14
awarded  Supporter