Answers for "curried function"

12

async function fetchJson

async function getUserAsync(name) 
{
  let response = await fetch(`https://api.github.com/users/${name}`);
  let data = await response.json()
  return data;
}

getUserAsync('yourUsernameHere')
  .then(data => console.log(data));
Posted by: Guest on February-16-2020
4

what is currying

a technique that applies a function 
to its arguments one at a time, with 
each application returning a new function 
that accepts the next argument.
Posted by: Guest on November-21-2020
0

what is a curried function

Curried Function
// Non-curried
function add(a, b, c) {
  return a + b + c
}

add(1, 2, 3)
//-> 6

// Curried
function addd(a) {
  return function (b) {
    return function (c) {
      return a + b + c
    }
  }
}

addd(1)(2)(3)
//-> 6
Posted by: Guest on November-20-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language