Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
Get data return from customize face() function in variable in javascript

Actually i want to make a function for my user so that they can fatch any json data with super simplefied way. Thats why this function produce object variable just by calling object. Its searching for object and display its value.

I have made it.

Now i want to get the function return in a variable so that my user do whatever they want.

I am new in JavaScript so i cant figure out with the answer that already exist in this site. Thats why i post my problem. Plz Someone help me here with my code.

My progress is below:

function curl(x,y){let txt; var result; var rx = new RegExp(`["|" ]${y}[ "|" | " |"]:[ "|" | " |"|["](.+?)[}|"]`, 'g');
fetch(x).then(r => r.text()).then(t => {
t.match(rx).forEach(e => { var v = e.replace(rx, '$1');  txt += v + ',' });
var re = decodeURIComponent(JSON.parse('"' + txt.replace(/\"/g, '\\"') + '"'));
result = re.replace(/undefined|"|,\s*$/g,'').replace(/,,/g,'<br>');
alert(result);
});
}
curl('https://list.ly/api/v4/meta?url=http://google.com','images');

Now i want like this:

var data = curl('https://list.ly/api/v4/meta?url=http://google.com','images');
alert(data);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!