Find Jobs
Hire Freelancers

I need to access a variable outside a java script node.js fetch function

€8-10 EUR

In Progress
Posted almost 5 years ago

€8-10 EUR

Paid on delivery
//Here's a simple example of my problem, I've been trying to solve it all morning but I just can't manage for the life of me, it has something to do with promises and local scope, like the code will keep running even if the function didn't complete it's task.. var testMe = "empty" [login to view URL](testMe) // outputs "empty" fetch(exampleInfo) .then(function(response) { return [login to view URL]() }) .then(function(myJson) { [login to view URL](myJson) // outputs "full" testMe = myJson [login to view URL](testMe) // outputs "full" }); [login to view URL](testMe) // outputs "empty"
Project ID: 20388266

About the project

3 proposals
Remote project
Active 5 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello , sir. How are you? I just saw your project description carefully. I am very interested in your project. I have already solved it. I have rich experience in Web development. I am a full time developer and can work for you for a long time. I am ready to start your project immediately. I am sure I can satisfy you surely and complete in a short time. Please send your message so that we can discuss about your project.
€10 EUR in 7 days
5.0 (5 reviews)
4.6
4.6
User Avatar
I think you are not hiring. But, the problem here is that you are using fetch which is an asynchronous function. So, you have to wait async-await or callbacks. Text me for more info.
€8 EUR in 1 day
0.0 (0 reviews)
0.0
0.0
3 freelancers are bidding on average €9 EUR for this job
User Avatar
is it done or yet need to be solved, I'm a javascript expert and I can do it for you if it's still out there.
€10 EUR in 7 days
5.0 (3 reviews)
2.7
2.7

About the client

Flag of MALTA
Birkirkara, Malta
5.0
1
Payment method verified
Member since Dec 8, 2018

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.