This is what your code translates to:
var f5, f6, f7;f5 = function(x) { return 500 + x;};f6 = function(x) { return 600 + x;};f7 = function(x) { return 700 + x;};console.log(f5(5, f6(6, f7(7)))); //505console.log(f5(5, f6(6, f7(7)))); //505console.log(f5(5, f6(6, f7(7)))); //505console.log(f5(5), f6(6), f7(7)); //505, 606, 707So in your 1st 3 logs you are calling f5 which only takes in one parameter therefore the rest of the arguments are ignored.
What you can do is this:
console.log( f5 5 f6 6 f7 7 )The multiple lines forces it to run as individual functions
You can do the same for objects, putting newlines adds a comma:
obj = a: 42 b: 23
ليست هناك تعليقات:
إرسال تعليق