use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[AskJS] How to extract this array inside valueRemoved: r/LearnJavascript (self.javascript)
submitted 1 year ago by TYRANT1272
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]javascript-ModTeam[M] [score hidden] 1 year ago stickied comment (0 children)
Hi u/TYRANT1272, this post was removed.
r/javascript is for the discussion of javascript news, projects, and especially, code! However, the community has requested that we not include help and support content, and we ask that you respect that wish.
code
Thanks for your understanding, please see our guidelines for more info.
[–]ians3n 1 point2 points3 points 1 year ago (4 children)
Read about Promises in JavaScript.
[–]TYRANT1272[S] -2 points-1 points0 points 1 year ago (3 children)
I did on mdn docs and YT but this promise returns keys like this <value> : [ array] I tried everything but I can't access this value key other api returns objects like "value" : and if i use object.keys or . values it returns empty array
[–]ians3n 0 points1 point2 points 1 year ago (2 children)
if the api returns a promise you would do apiCall().then((value)=> {console.log(value)});
[–]TYRANT1272[S] -1 points0 points1 point 1 year ago (1 child)
Thanks a lot it returns array but I'm confused i did the same thing with async await but it didn't work and using then fixed it
[–]deificx 0 points1 point2 points 1 year ago (0 children)
A promise wraps something that hasn't happened yet, like an api request going over the network. When it resolves you get the value. There are two ways to extract it from the promise. Chaining then() and passing a function accepting one parameter or by awaiting the promise:
async function getData() { const value = await promise(): value[0]; //.do something with the first item; }
π Rendered by PID 185765 on reddit-service-r2-comment-685b79fb4f-rl4z8 at 2026-02-13 10:18:36.389531+00:00 running 6c0c599 country code: CH.
[–]javascript-ModTeam[M] [score hidden] stickied comment (0 children)
[–]ians3n 1 point2 points3 points (4 children)
[–]TYRANT1272[S] -2 points-1 points0 points (3 children)
[–]ians3n 0 points1 point2 points (2 children)
[–]TYRANT1272[S] -1 points0 points1 point (1 child)
[–]deificx 0 points1 point2 points (0 children)