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.

 2

 / 1 

Here’s a call to the async function randomPause :

randomPause(100,0)

.then(handleNumber(x))

.catch (function (x) {

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

});

and here is the code for the other function:

 

function handleNumber(x) {

console.log(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”

 

 3

/ 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; }

 

4

 / 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.

“this”.

“hobbi”.

 

5

/ 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();

console.log(y);

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

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

“this.x”

“cows”.

 

6

/ 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.


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


blank

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

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


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论