Click here to Skip to main content
15,569,768 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: React date formatting Pin
Peter_in_27807-Apr-22 4:34
professionalPeter_in_27807-Apr-22 4:34 
AnswerRe: React date formatting Pin
Richard Deeming7-Apr-22 5:01
mveRichard Deeming7-Apr-22 5:01 
AnswerRe: React date formatting Pin
Jeremy Falcon26-Oct-22 13:01
professionalJeremy Falcon26-Oct-22 13:01 
Questionjava project Pin
Turki F773-Apr-22 16:30
Turki F773-Apr-22 16:30 
AnswerRe: java project Pin
Richard Deeming3-Apr-22 22:26
mveRichard Deeming3-Apr-22 22:26 
QuestionAsync call inside loop finishes later than loop itself Pin
Bohuslav Parenica2-Apr-22 1:51
Bohuslav Parenica2-Apr-22 1:51 
AnswerRe: Async call inside loop finishes later than loop itself Pin
Richard Deeming3-Apr-22 22:33
mveRichard Deeming3-Apr-22 22:33 
AnswerRe: Async call inside loop finishes later than loop itself Pin
Jeremy Falcon26-Oct-22 13:14
professionalJeremy Falcon26-Oct-22 13:14 
In addition to what Richard said, this is one of the perfect times to use a generator function. Same concept, just with terse syntax.
JavaScript
async function* fetchStuff() {
  const response1 = await fetch('https://some.com/stuff1');
  yield await response1.json();

  const response2 = await fetch('https://some.com/stuff2');
  yield await response2.json();
}

// loop through results
for await (const stuff of fetchStuff()) {
  console.log(stuff);
}

// or you can still use Promise.all if you want
const responses = await Promise.all([...fetchStuff()]);

Jeremy Falcon

QuestionTransforming Excel to Html (javascript) Pin
Member 1554681528-Mar-22 1:09
Member 1554681528-Mar-22 1:09 
GeneralMessage Closed Pin
23-Mar-22 20:02
Richardrussel23-Mar-22 20:02 
QuestionMessage Closed Pin
23-Mar-22 20:00
Richardrussel23-Mar-22 20:00 
QuestionFormulario js Pin
Member 155607559-Mar-22 8:18
Member 155607559-Mar-22 8:18 
AnswerRe: Formulario js Pin
RedDk9-Mar-22 8:33
RedDk9-Mar-22 8:33 
QuestionCreating a responsive menu Pin
Member 1554804125-Feb-22 5:58
Member 1554804125-Feb-22 5:58 
AnswerMessage Closed Pin
25-Feb-22 6:40
Member 1554804125-Feb-22 6:40 
AnswerMessage Closed Pin
25-Feb-22 6:41
Member 1554804125-Feb-22 6:41 
AnswerRe: Creating a responsive menu Pin
Member 1554804125-Feb-22 6:44
Member 1554804125-Feb-22 6:44 
AnswerRe: Creating a responsive menu Pin
Richard Deeming27-Feb-22 22:12
mveRichard Deeming27-Feb-22 22:12 
QuestionAdding auto expand functionality to collapsible script Pin
Member 1554681524-Feb-22 4:38
Member 1554681524-Feb-22 4:38 
AnswerRe: Adding auto expand functionality to collapsible script Pin
Member 1554681524-Feb-22 10:52
Member 1554681524-Feb-22 10:52 
QuestionProper decoding using Vanilla Javascript Pin
jkirkerx17-Feb-22 13:04
professionaljkirkerx17-Feb-22 13:04 
AnswerRe: Proper decoding using Vanilla Javascript Pin
Richard Deeming17-Feb-22 22:33
mveRichard Deeming17-Feb-22 22:33 
GeneralRe: Proper decoding using Vanilla Javascript Pin
jkirkerx18-Feb-22 7:49
professionaljkirkerx18-Feb-22 7:49 
GeneralRe: Proper decoding using Vanilla Javascript Pin
Richard Deeming24-Feb-22 1:21
mveRichard Deeming24-Feb-22 1:21 
GeneralRe: Proper decoding using Vanilla Javascript Pin
jkirkerx24-Feb-22 6:37
professionaljkirkerx24-Feb-22 6:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.