Microsoft
98-375 · Question #26
Which two code segments declare JavaScript functions? (Choose two.)
The correct answer is C. var a=new Foo(); D. Foo=function(a){. function add(x, y) { var t = add(1, 2); //x,y is the argument. 'returnx+y' is the function body, which is the last in the argument list. var add = new Function('x', 'y', 'return x+y'); var t = add(1, 2); Not A: funct keyword not used in JavaScript
Understanding Game Programming
Question
Which two code segments declare JavaScript functions? (Choose two.)
Options
- Avarfunct= (a);
- Bfunction Foo(a){
- Cvar a=new Foo();
- DFoo=function(a){
How the community answered
(31 responses)- A13% (4)
- B10% (3)
- C77% (24)
Explanation
function add(x, y) { var t = add(1, 2); //x,y is the argument. 'returnx+y' is the function body, which is the last in the argument list. var add = new Function('x', 'y', 'return x+y'); var t = add(1, 2); Not A: funct keyword not used in JavaScript
Topics
#JavaScript#function declaration#syntax#variable assignment
Community Discussion
No community discussion yet for this question.