Exam4Training

What can the developer do to change the code to print “Hello World”?

The developer has a function that prints “Hello” to an input name. To test this, the developer created a function that returns “World”. However the following snippet does not print “Hello World”.

What can the developer do to change the code to print “Hello World”?
A . Change line 7 to ) () ;
B . Change line 2 to console.log(‘Hello’ , name() );
C . Change line 9 to sayHello(world) ();
D . Change line 5 to function world ( ) {

Answer: B

Exit mobile version