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
8 changes: 8 additions & 0 deletions src/components/DivElement.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
// Import HTMLElement here
import HTMLElement from './HTMLElement';

// Define class here

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

}
}

// Export class here
export default DivElement;
13 changes: 12 additions & 1 deletion src/components/HTMLElement.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
// 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;
3 changes: 3 additions & 0 deletions src/rolodex/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
12 changes: 4 additions & 8 deletions src/rolodex/rolodexPrinter.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
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;

console.log('First name: ' + firstName + '\nLast name: ' + lastName + '\nEmail: ' + email + '\nPhone number: ' + phone + '\n');
people.forEach((element) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
people.forEach((element) => {
people.forEach(({ name, email, phone }) => {

const { name, email, phone } = element;
const [firstName, lastName] = name.split(' ');
console.log(`First name: ${firstName}\nLast name: ${lastName}\nEmail: ${email}\nPhone number: ${phone}`);
});
27 changes: 13 additions & 14 deletions src/timer/Timer.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
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(instance.seconds);
instance.seconds -= 1;
}, 1000);
};
start() {
const timerInterval = setInterval(() => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

if (this.seconds === 0) {
clearInterval(timerInterval);
}
this.seconds -= 1;
}, 1000);
}
}

export default Timer;