WEB代写 | web programming quiz

本次美国代写主要为web programming的quiz

let m = document.getElementById(“activity”);

In this line, “document” is…

a variable that should have been defined earlier in the program.

a Javascript keyword.

a function that selects an element of a Web page.

a Javascript object provided by the browser.


 / 1 

Here’s a call to the async function randomPause :



.catch (function (x) {

console.log(“in catch”,x);


and here is the code for the other function:


function handleNumber(x) {



What happens when we run this code?


It runs correctly.

It will crash when the async function randomPause fails.

It will crash because it does not use arrow functions.

It will crash when attaching the callback using “.then”



/ 1 

Here’s a function expression using an arrow function.

x => “the number “+x;

An equivalent function expression is…

function (x) { “the number “+x; }

x = “the number “+x;

function (x) { return “the number “+x; }

x = function () { return “the number “+x; }



 / 1 

Here is an object which holds a string, and has a method that removes the last letter.  Notice the return value of the method.

let strObj = {

data: “hobbit”,

shorten: function () {

this.data = this.data.slice(0,-1);

return this;



After executing the following code, what does the variable x contain?

let x = strObj.shorten();

the method .shorten().

the object strObj.





/ 1 

Here’s a function that takes a function as input and returns an object.

function makeObj(f) {

return {

x: “cow”,

manipulate: function () {

return f(this.x);




What do the following lines print?

let y = makeObj(function (x) { return x+”s”; } ).manipulate();


“function() {…}”, because y contains a function.

“object {…}” because y contains an object.





/ 4 

Please write a Javascript for loop that constructs an array of ten functions.  We will call the array “adders”, and we want the function in adders[i] to take an input x and return x+i.  We initialize adders as an array of length 10:

let adders = [null, null, null, null, null, null, null, null, null, null]



console.log(“Adders”,adders[4](3), adders[1](10));

Your loop should go where the blanks are.  The last line should then print “Adders 7 11”.   Your loop can have more than two lines.



本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: itcsdx@outlook.com  微信:itcsdx