Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-plugin-import": "^2.20.2",
"jest": "^25.2.7"
"jest": "^25.2.7"
}
}
9 changes: 9 additions & 0 deletions src/components/DivElement.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
// Import HTMLElement here
import HTMLElement from './HTMLElement';

// Define class here

class DivElement extends HTMLElement {
constructor(content) {
super('div', content);
}
}


// Export class here
export { DivElement as default };
12 changes: 11 additions & 1 deletion src/components/HTMLElement.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
// Define class here
class HTMLElement {
constructor(tag, content) {
this.tag = tag;
this.content = content;
}

render() {
return `<${this.tag}>${this.content}</${this.tag}>`;
}
}

// Export class here
export default {};
export { HTMLElement as default };
11 changes: 4 additions & 7 deletions src/rolodex/rolodexPrinter.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import people from './people.json';

people.forEach(function (person) {
const names = person.name.split(' ');
const firstName = names[0];
const lastName = names[1];
const email = person.email;
const phone = person.phone;
people.forEach((person) => {
const [firstName, lastName] = person.name.split(' ');
const { email, phone } = person;

console.log('First name: ' + firstName + '\nLast name: ' + lastName + '\nEmail: ' + email + '\nPhone number: ' + phone + '\n');
console.log(`First name: ${firstName}\nLast name: ${lastName}\nEmail: ${email}\nPhone number: ${phone}\n`);
});
28 changes: 15 additions & 13 deletions src/timer/Timer.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
function Timer(seconds) {
this.seconds = seconds;
}

Timer.prototype.start = function () {
var instance = this;
var timerInterval = setInterval(function () {
if (instance.seconds === 0) {
clearInterval(timerInterval);
}
class Timer {
constructor(seconds) {
this.seconds = seconds;
console.log(this.seconds);
}

console.log(instance.seconds);
instance.seconds -= 1;
}, 1000);
};
start() {
const timerInterval = setInterval(() => {
if (this.seconds === 0) {
clearInterval(timerInterval);
}
console.log(this.seconds);
this.seconds -= 1;
}, 0.0000001);
}
}

export default Timer;
1 change: 1 addition & 0 deletions src/timer/runTimer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ import Timer from './Timer';

const countdown = new Timer(10);
countdown.start();
console.log(countdown);
1 change: 1 addition & 0 deletions test/DivElement.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('DivElement class', () => {
});

it('should be a class with the name DivElement', () => {
console.log(instance);
expect(instance.constructor.name).toContain('DivElement');
});

Expand Down