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, thedeveloper 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...
Which two assert statements are valid tests for the function?
A developer needs to test this function: 01 const sum3 = (arr) => ( 02 if (!arr.length) return 0, 03 if (arr.length === 1) return arr[0], 04 if (arr.length === 2) return arr[0] + arr[1], 05 return arr[0] + arr[1] + arr[2], 06 ); Which two assert statements are valid...
What is the value of the result after line 10 executes?
Refer to code below: function Person() { this.firstName = ’John’; } Person.prototype ={ Job: x => ‘Developer’ }; const myFather = new Person(); const result =myFather.firstName + ‘ ‘ + myFather.job(); What is the value of the result after line 10 executes?A . Error: myFather.job is not a function B....
Which statement flattens myArray when it can be arbitrarily nested?
myArraym can have one level, two levels, or more levels. Which statement flattens myArray when it can be arbitrarily nested?A . myArray. reduce ((prev, curr) => prev.concat(curr) [ ]); B. myArray. join (","). split (","); C. [ ] .concat {. . .myArray) ; D. myArray.flat(Infinity);View AnswerAnswer: A
Given the JavaScript below:
Given the JavaScript below: Which code should replace the placeholder comment on line 05 to highlight accounts that match the search string'A . 'yellow' : null B. null : 'yellow’ C. 'none1 : "yellow’ D. 'yellow : 'none'View AnswerAnswer: D
What is the console output?
Refer to the following code block: What is the console output?A . > Better student Jackie got 70% on test. B. > Jackie got 70% on test. C. > Uncaught Reference Error D. > Better student Jackie got 100% on test.View AnswerAnswer: D
Which global variable can be used in the script?
A developer is setting up a Node,js server and is creating a script at the root of the source code, index,js, that will start the server when executed. The developer declares a variable that needs the folder location that the code executes from. Which global variable can be used in...
Which two lines of code result in a second array, arr2 being created such that arr2 is not a reference to arr1?
Refer to the following array: Let arr1 = [ 1, 2, 3, 4, 5 ]; Which two lines of code result in a second array, arr2 being created such that arr2 is not a reference to arr1?A . Let arr2 = arr1.slice(0, 5); B. Let arr2 = Array.from(arr1); C. Let...
what is the result of executing the code?
A developer writes the code below to calculate the factorial of a given number function sum(number) { return number * sum(number-1); } sum (3); what is the result of executing the code?A . 0 B. 6 C. Error D. -InfinityView AnswerAnswer: C
Why does the function bar have access to variable a?
Refer to the code below: function foo () { const a =2; function bat() { console.log(a); } return bar; } Why does the function bar have access to variable a?A . Inner function’s scope B. Hoisting C. Outer function’s scope D. Prototype chainView AnswerAnswer: C