Hello everyone, could I ask about something out of the topic on the course? Because I’ve struggle when I try to solve the code🙏
Sure, what’s your question? What is giving you troubles?
Could you share the code as text, instead of image? What is the expected output, what have you tried so far?
You have to call the function and pass it the two arguments. You can log out the function return value directly in the console.log.
const value1 = 1;
const value2 = 2;
function fn(param1, param2) {
return param1 + param2;
}
console.log(fn(value1, value2)) // 3
You can’t log out answer outside the function. It is scoped to the function, you can log the functions return value (which is the answer array)
My expected output is like this.
[ ‘{iphone with price 1000}’,
‘{samsung with price 3000}’,
‘{oppo with price 4050}’,
‘{xiaomi with price 4060}’,
‘{huwawe with price 4070}’ ]
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
