-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDay4.CreateRecObject.js
52 lines (37 loc) · 1.12 KB
/
Day4.CreateRecObject.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Objective
// In this challenge, we practice creating objects. Check out the attached tutorial for more details.
// Task
// Complete the function in the editor. It has two parameters: and . It must return an object modeling a rectangle that has the following properties:
// : This value is equal to .
// : This value is equal to .
// : This value is equal to
// : This value is equal to
// Note: The names of the object's properties must be spelled correctly to pass this challenge.
// Input Format
// The first line contains an integer denoting .
// The second line contains an integer denoting .
// Constraints
// Output Format
// Return a object that has the properties specified above. Locked code in the editor prints the returned object's , , , and to STDOUT.
// Sample Input 0
// 4
// 5
// Sample Output 0
// 4
// 5
// 18
// 20
// Explanation 0
// Given a of and a of , the Rectangle object's is and its is .
/*
* Complete the Rectangle function
*/
function Rectangle(a, b) {
const rec = {
length: a,
width: b,
perimeter: 2 * (a + b),
area: (a * b)
}
return rec;
}