-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJob matching 1.js
31 lines (22 loc) · 1.37 KB
/
Job matching 1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Let's build a matchmaking system that helps discover jobs for developers based on a number of factors.
// One of the simplest, yet most important factors is compensation. As developers we know how much money we need to support our lifestyle, so we generally have a rough idea of the minimum salary we would be satisfied with.
// Let's give this a try. We'll create a function match which takes a candidate and a job, which will return a boolean indicating whether the job is a valid match for the candidate.
// A candidate will have a minimum salary, so it will look like this:
// let candidate = {
// minSalary: 120000
// }
// A job will have a maximum salary, so it will look like this:
// let job = {
// maxSalary: 140000
// }
// If either the candidate's minimum salary or the job's maximum salary is not present, throw an error.
// For a valid match, the candidate's minimum salary must be less than or equal to the job's maximum salary. However, let's also include 10% wiggle room (deducted from the candidate's minimum salary) in case the candidate is a rockstar who enjoys programming on Codewars in their spare time. The company offering the job may be able to work something out.
function match(candidate, job) {
if((candidate.minSalary*.9) <= job.maxSalary) {
return true;
} else if(!candidate.minSalary || !job.maxSalary) {
return error;
} else {
return false;
}
}