Discussion Overview
The discussion revolves around the use of functions as arguments in JavaScript, specifically focusing on how to correctly implement a function that calls another function. Participants explore various coding approaches and clarify misunderstandings related to function syntax and behavior.
Discussion Character
- Exploratory
- Technical explanation
- Debate/contested
- Homework-related
Main Points Raised
- Some participants propose a function `cube` that should call `square`, but initial attempts are incorrect due to misunderstanding how to pass arguments.
- One participant corrects another by stating that `cube` should call `square(x)` instead of just `square`.
- A participant introduces a C/C++ example to illustrate using function pointers, which raises questions about language context.
- Several participants express confusion about the programming language being discussed, with clarifications confirming it is JavaScript.
- One participant suggests that using functions as arguments can be done with a syntax like `var cube = function(f,x) { return x * f(x); }`, demonstrating a correct implementation.
- Another participant acknowledges that the original problem was misunderstood and seeks further clarification on how to assign parameters within functions.
- Some participants emphasize the importance of experimentation with the language rather than relying solely on forum assistance for simple questions.
- Multiple participants explore the idea of using functions as parameters, with varying levels of confidence in their syntax and correctness.
Areas of Agreement / Disagreement
There is no consensus on the best approach to using functions as arguments, as participants present multiple methods and interpretations. Some express confidence in their solutions, while others remain uncertain about syntax and implementation.
Contextual Notes
Participants express uncertainty regarding the correct syntax for JavaScript and the specific requirements of the original problem. There are also discussions about the appropriateness of using functions as arguments in this context.
Who May Find This Useful
Readers interested in JavaScript programming, particularly those learning about function usage and argument passing, may find this discussion beneficial.