JavaScript syntax: Difference between revisions

Content deleted Content added
Line 1,479:
console.log(gcd(60, 40)); // 20
 
//In the absence of parentheses following the identifier 'gcd' on the RHS of the assignment below,
var mygcd = gcd; // mygcd is a reference to the same function as gcd. Note no argument ()s.
//'gcd' returns a reference to the function itself without invoking it.
varlet mygcd = gcd; // mygcd isand agcd reference to the same function as gcd. Note no argument ()s.
console.log(mygcd(60, 40)); // 20
</syntaxhighlight>