Skip to main content

All Questions

1 vote
1 answer
97 views

Why is the callback provided to `XRSession.requestAnimationFrame()` not getting called?

Here is a minimal example which reproduces a problem I have encountered in a more complex situation: let session; const dummyRenderLoop = (time, frame) => { if (!session) return; ...
user19642323's user avatar
1 vote
1 answer
86 views

In Javascript how is it possible to incorporate the result of a requested callback function in running code?

I come from PIC assembly-language programming where programs normally run continuously. I've now been learning Javascript for quite a while but have become a little blocked with the use of callback ...
SaK's user avatar
  • 23
-1 votes
2 answers
95 views

Lack of rejection handler still changes the state of the returned Promise

According to MDN docs, then() and catch() returns a pending Promise immediately and if the handler functions doesn't return anything, the returned Promise becomes fulfilled with an undefined value. So,...
Intangible _pg18's user avatar
3 votes
0 answers
60 views

Flow of Control between Handlers in Promises [duplicate]

I want to know why the following 2 codes are giving different outputs. Code 1: const motherPromise = new Promise((resolve, reject) => { reject(new Error("Milk has spilled due to overboiling&...
Intangible _pg18's user avatar
-1 votes
3 answers
145 views

Unexpected outputs when implementing Promise Chaining in JavaScript

I have a task as below which I have to solve using Promise Chaining in JavaScript and I am getting some unexpected outputs -: Task: If Mike is able to clean the room, then he goes for football. In ...
Intangible _pg18's user avatar
-1 votes
1 answer
54 views

SetTimeout () in javascript

What is the point of giving the time duation in setTimeout() function ? Altough the callback will have to wait for the call stack to be completely empty. For example if i write this code. setTimeout(()...
Chinmay Behera's user avatar
0 votes
1 answer
120 views

Koa.js backend unable to access response body in callback function

I have a backend created using koa.js which contains a callback function to set the response body. In particular, the middleware function for the backend looks like the follow exports....
Kevin Tommy's user avatar
0 votes
0 answers
17 views

Function returns undefined when returning within .then keyword [duplicate]

I have a program that returns true or false correspondingly based on the result of an asynchronous function someAsyncFunction(), which looks like the follow: function getResult(param) { ...
Kevin Tommy's user avatar
0 votes
0 answers
64 views

forEach() with forOf() with async/await?

I was making this program on asynchronously typer? Where every line typed asynchronously? This is my html <h1 data-type data-type-min="100" data-type-max="300">How are you<...
xaviour1504's user avatar
0 votes
3 answers
115 views

Write a callback function to print three characters sequentially using a provided async function with random timeout

I was asked the following question in a JavaScript interview. I was unable to answer it. Please help! const printString = (string, callback) => { setTimeout(() => { console.log(...
Abhishek Satyavolu's user avatar
1 vote
1 answer
93 views

Working with multiple API calls from a Node/Express intermediate API, trying to use promise.all()

I am discovering all kinds of gaps in my understanding during this project. I am working on building an intermediate API server. Some end-points take an array of info, then make an external call for ...
Jeffrey Bentley's user avatar
0 votes
1 answer
456 views

How that node.js event loop work and how can it handle multiple requests?

I was trying to test some asynchronous code in node.js. My understanding is that if there is some asynchronous operation going on, Node.js we will work on the new request. I have written a simple code ...
mjsg's user avatar
  • 1
0 votes
0 answers
23 views

Run time-consuming function with Promises without blocking runtime [duplicate]

I'm trying to understand how to use time consuming function with Promises. I have some nonsense, but time consuming function computation() (that I create for demonstration purpose), that would need 3-...
VelikiyMalchik's user avatar
-1 votes
1 answer
119 views

Where are the callbacks of a promise executed?

When it is time to execute the callbacks of then, catch, or finally, where are they executed? From what I have read on Stack Overflow, it is said that they are executed in the call stack of the main ...
user avatar
1 vote
1 answer
617 views

How to await a Microsoft speechrecognizer async function and store the text into a variable from the callback - NodeJS

const fs = require("fs"); const sdk = require("microsoft-cognitiveservices-speech-sdk"); // This example requires environment variables named "SPEECH_KEY" and "...
Nicholas Drogo's user avatar

15 30 50 per page
1
2 3 4 5
60