search

Home  >  Q&A  >  body text

javascript - What is the difference between putting a function in parentheses and not putting it in parentheses?

The code in js is as follows:

function ff(a,b){...};
(0,ff)(_a,_b); // ~>1
ff(_a,_b); // ~>2

What is the difference between 1 and 2?
//You can Baidu comma operator!

伊谢尔伦伊谢尔伦2779 days ago457

reply all(1)I'll reply

  • 阿神

    阿神2017-05-19 10:48:05

    comma operator

    var x = 0;
    var y = 1;
    var z = (x, y); // 1
    var w = y; // 2
    

    It’s the same as your example

    reply
    0
  • Cancelreply