Challenge: Solution Review
Explore how the chain of responsibility behavioral pattern assigns tasks based on employee skill levels. Learn to implement handler classes, set up a chain, and forward requests in JavaScript to manage work delegation efficiently.
We'll cover the following...
We'll cover the following...
Solution
Explanation
In this challenge, you had to use the chain of responsibility pattern to assign work to employees. We start by creating an employee. Here’s what the Employee class looks like:
class Employee
{
constructor(name,level){
this.name = name
this.level = level
}
getLevel(){
return this.level
}
getName(){
return this.name
}
}
An employee will have a name and a level ...