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
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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(content);
this.content = content;
this.tag = 'div';
}
}

// Export class here
export default DivElement;
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 default HTMLElement;
10 changes: 4 additions & 6 deletions src/rolodex/rolodexPrinter.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import people from './people.json';

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

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

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

// console.log(instance.seconds);
// instance.seconds -= 1;
// }, 1000);
// };

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(instance.seconds);
instance.seconds -= 1;
}, 1000);
};
start() {
const timerInterval = setInterval(() => {
if (this.seconds === 0) {
clearInterval(timerInterval);
}

console.log(this.seconds);
this.seconds -= 1;
}, 1000);
}
}

export default Timer;