Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

Java1234官方群25:java1234官方群17
Java1234官方群25:838462530
        
SpringBoot+SpringSecurity+Vue+ElementPlus权限系统实战课程 震撼发布        

最新Java全栈就业实战课程(免费)

springcloud分布式电商秒杀实战课程

IDEA永久激活

66套java实战课程无套路领取

锋哥开始收Java学员啦!

Python学习路线图

锋哥开始收Java学员啦!

javascript core assessment framework PDF 下载


分享到:
时间:2021-07-30 09:21来源:http://www.java1234.com 作者:转载  侵权举报
javascript core assessment framework PDF 下载
失效链接处理
javascript core assessment framework PDF 下载


本站整理下载:
提取码:e9b8 
 
 
相关截图:
 
主要内容:


Expected knowledge
• Closures
3 Can Include
• Everything from the code-writing task.
• Implementing/using callbacks.
• Implementing a closure.
• Using functional Array prototype methods like forE-
ach/map/reduce.
• Using function bindings and working with this.
• Using closures.
• Using dictionary objects.
• Using exceptions.
• Storing values in a dictionary object, using it as a
counter and iterating over it.
• Modifying this binding of a function by using any
binding mechanism.
• Throwing errors and handling exceptions.
7 Should Exclude
• Anything that requires optimizing an algorithm.
• Async operations.
• Classes.
Example 2.2.3.
Implement the createCountdown function so that it
returns a new countdown object with a tick() method
that returns the current value and decreases it by 1 after
each call and an isOver method that returns true or
false indicating whether the countdown reached to 0.
1 function createCountdown(initialValue) {
2 if (!Number.isInteger(initialValue) || initialValue <
1) { ,!
3 throw new Error('Invalid initial value');
4 }
5 let value = initialValue;
6 let isOver = false;
7 return {
8 tick() {
9 const returnValue = value;
10 if (value > 0) {
11 value--;
12 } else {
13 isOver = true;
14 }
15 return returnValue;
16 },
17 isOver() {
18 return isOver;
19 }
20 };
21 }
The 4th task
The expected time for solving this task is 10 minutes.
This is a recovery task meant to assess a deeper under-
standing of exception handling, async operations and
promises.
Expected knowledge
• Async operations and promises.
3 Can Include
• Everything from the code-writing task.
• Implementing/using callbacks.
• Using functional Array prototype methods like
forEach/map/reduce.
• Using exceptions.
• Using promises.
• Throwing errors and handling exceptions.
7 Should Exclude
• Anything that requires optimizing an algorithm.
• Closures.
• Classes.
4
Example 2.2.4.
Implement a function that accepts an arbitrary number
of promises as an input and returns a promise that is
rejected with the number 0 if all of the input promises
get rejected, or is resolved with the sum of the values
of the resolved input promises otherwise.
1 function promiseCombiner(...promises) {
2 if (promises.length === 0) {
3 throw new Error('At least one argument is required');
4 }
5
6 let hasOneResolved = false;
7
8 const mapPromise = p => p
9 .then((e) => {
10 hasOneResolved = true;
11 return e;
12 })
13 .catch(() => 0);
14
15 return Promise.all(promises.map(mapPromise))
16 .then(vals => hasOneResolved ? vals.reduce((sum, e)
=> e + sum) : Promise.reject(0)); ,!
17 }
2.3 Quiz tasks
For the quiz tasks, 8 topics are divided into 4 groups,
each containing 4 quiz tasks. So, in total there are 16
di?erent quiz tasks. Table 1 shows the description of
the groups and the task distribution between the topics.
Quiz Group 1: (tasks 5-8)
The expected total time for solving all the tasks of this
group is 8 minutes.
Expected knowledge
• The di?erence between passing by value and passing
by reference.
• Function declarations and using passed arguments.
• Function calls.
• Callbacks.
• Using simple objects/maps.
Example 2.3.1.
Which of the listed options would prevent the original
u object from being modi?ed? (Select all that apply.)
1 function getNormalizedUser(user) {
2 user.username = user.username.toLowerCase();
3 return user;
4 }
5
6 let u = {
7 id: 12,
8 username: 'SomeUser',
9 };
10 let u2 = getNormalizedUser(u);
1) In getNormalizedUser, copy user using
JSON.parse(JSON.stringify(user)) then modify
and return the copied version.
2) Change the implementation of getNormalizedUser
to this:
return ...user, username:
user.username.toLowerCase() ;
3) Change the declaration from let u to const u.
Answer: Either (1) or (2) would work.
Example 2.3.2.
With the following code, which of the given options will
run without an error? (Select all that apply.)

 

------分隔线----------------------------

锋哥公众号


锋哥微信


关注公众号
【Java资料站】
回复 666
获取 
66套java
从菜鸡到大神
项目实战课程

锋哥推荐