-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop.ts
More file actions
62 lines (52 loc) · 1.74 KB
/
oop.ts
File metadata and controls
62 lines (52 loc) · 1.74 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
### Task: Process Job Offers
Description:
You're given an array of job offers. Each job offer is an object like this (see the strings-arrays-objects-functions-promises.js file):
{
id: 1,
title: "Frontend Developer",
location: "Texas, USA",
salary: "$100000",
skills: ["JavaScript", "React", "CSS"],
},
{
id: 2,
title: "Full Stack Engineer",
location: "London, UK",
salary: "£80000",
skills: ["JavaScript", "Node.js", "Express"],
},
*/
type JobOfferType = {
id: number;
title: string;
location: string;
salary: string;
skills: string[];
};
interface JobOffersORM {
// TODO: add constructor that accepts an array of job offers
summarizeJobOffers: () => string[];
}
const jobOffersData: JobOfferType[] = [];
class JobOffersORM implements JobOffersORM {
// TODO: implement constructor that accepts an array of job offers
// TODO: implement summarizeJobOffers method
}
const currentJobOffers = new JobOffersORM(jobOffersData);
const result = currentJobOffers.summarizeJobOffers();
/**
* Write a class for processing job offers.
* The class should implement the following:
* - A constructor that accepts an array of job offers
* - A method `summarizeJobOffers()` that returns an array of strings.
* - String example: "Job Offer #1: Full Stack Engineer in London, UK, £80000, skills: JavaScript, Node.js, Express"
*
const referenceResult = [
"Job Offer #1: Full Stack Engineer in London, UK, £80000, skills: JavaScript, Node.js, Express",
"Job Offer #2: Full Stack Engineer in London, UK, £80000, skills: JavaScript, Node.js, Express",
];
*
*
* - The class should handle any errors gracefully, such as invalid order data (missing fields, incorrect types, etc. - how can you validate it).
*/