Difference between Function and Function

Asked

Viewed 47 times

-2

I started studying Js recently and I am in doubt between the use of function and Function.

  • 1

    In what context? Edit your question and give more details.

1 answer

2

function is a Javascript keyword used to define a new function, already the Function references the class. Javascript functions are first class objects, each function you create is a new object.

function soma(a, b) {
  return a + b;
}

const somaPorInstanciacao = new Function("a", "b", `
  return a + b;
`);

console.log(soma(1, 2));
console.log(somaPorInstanciacao(1, 2));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.