Sep
26
awarded Nice Question
May
21
asked Is there a consistent way to access sites, libraries, and folders using REST?
May
8
awarded Notable Question
May
1
awarded Notable Question
Mar
24
comment Javascript foreach loop on associative array object
Instead of using hasOwnProperty it should be possible in all modern web browsers to iterate over the keys of an object using: Object.keys(arr_jq_TabContents).forEach( function(key) { ... } );
Mar
16
awarded Nice Question
Mar
9
awarded Yearling
Feb
19
awarded Caucus
Feb
5
awarded Critic
Jan
25
awarded Teacher
Jan
21
awarded Famous Question
Jan
9
answered Stopping the "Will I need this for the test" question
Dec
25
awarded Favorite Question
Dec
9
awarded Famous Question
Sep
19
awarded Popular Question
Aug
16
awarded Popular Question
Jul
19
accepted Why does this resolved Q promise responds to valueOf() with a promise?
Jul
18
awarded Commentator
Jul
18
comment Why does this resolved Q promise responds to valueOf() with a promise?
I was doing some more experimenting and I figured out that var a = Thing.fetch(1); a.valueOf(); doesn't work. If I have it as two lines in the console it works, but if I add those lines in my file a.valueOf() remains a promise. So when will the promise returned by fetch be resolved?
Jul
18
comment Why does this resolved Q promise responds to valueOf() with a promise?
Ok. After some experimenting I understand what you're talking about. Thing.fetch(1).valueOf() all happens in the same turn of the event loop, so even though promise has resolved at this point the new promise from fetch() has NOT resolved, so valueOf() shows me the promise. If I go var a = Thing.fetch(1); a.valueOf(); I get the value for the promise because the event loop has ticked and the new promise from fetch() has resolved. I'm going to clean up your answer a bit to make this explicit and then accept it. Thanks!
1 2 3 4 5