WEB代写 | Web Programming Quiz 2

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

 

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

 

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

 

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

 

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

发表评论