-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
63 lines (47 loc) · 1.41 KB
/
test.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
53
54
55
56
57
58
59
60
61
62
63
// const array = [];
// function timestable(multiplier){
// let rowOfNumbers = 0;
// for(let countX = 1; countX <= multiplier; countX++){
// for(let count = 1; count <= multiplier; count++){
// rowOfNumbers += count * countX + " ";
// }
// rowOfNumbers += "\n";
// console.log(rowOfNumbers)
// }
// }
// timestable(10);
// //Create a Fibonacci Sequence
// const result = totalNumbers => {
// //Each the number is added
// let n1 = 0, n2= 1, next;
// //Put it in to an array
// for(let i = 1; i <= totalNumbers; i++){
// console.log(n1);
// next = n1 + n2;
// n1 = n2;
// n2 = next;
// }
// }
// result(40);
const jonas = {
firstName: 'Jonas',
lastName: 'John',
birthYear: 1991,
job: 'teacher',
friends: ['Kate','Leah','Korn'],
hasDriverLicence: false,
getSummary: function(){
let summary = ""
let driverLicenceString = ""
this.age = 2023 - this.birthYear
if(this.hasDriverLicence === true){
driverLicenceString = "and he has a driver's licence";
}else {
driverLicenceString = "and he does not have a driver's licence";
}
summary = `${this.firstName} is a ${this.age}-year old teacher, ${driverLicenceString}`
return summary;
}
}
const summaryString = jonas.getSummary();
console.log(summaryString);