Skip to content

Week 1 HW Submission for J.Sorge#30

Open
Jiansorge wants to merge 1 commit intomodern-web-application-uw19:masterfrom
Jiansorge:master
Open

Week 1 HW Submission for J.Sorge#30
Jiansorge wants to merge 1 commit intomodern-web-application-uw19:masterfrom
Jiansorge:master

Conversation

@Jiansorge
Copy link

Week 1 HW Submission

  • Comfort rating on this assignment (1-5): 3
  • Completion rating on this assignment (complete/incomplete): Complete.
  • Github handles of code I've reviewed: none

Not sure how to use npm test.
npm test gave me errors below.. are these fine to ignore?:
/HTMLElement.js
8:9 error Expected 'this' to be used by class method 'render' class-methods-use-this
9:12 error Unexpected template string expression no-template-curly-in-string

/Timer.js
9:23 error 'timerInterval' is not defined no-undef
12:7 warning Unexpected console statement

@Jiansorge
Copy link
Author

how do I make the test work?

}

render() {
return '<${this.tag}>${this.content}</${this.tag}>';
Copy link

Choose a reason for hiding this comment

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

Remember when using this syntax you need to begin and end with ` not a regular apostrophe '

clearInterval(timerInterval);
}
start() {
this.timerInterval = setInterval(() => {
Copy link

Choose a reason for hiding this comment

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

Reserve this for persistent variables that are attached to the class. timerInterval is better defined using const.

start() {
this.timerInterval = setInterval(() => {
if (this.seconds === 0) {
clearInterval(timerInterval);
Copy link

Choose a reason for hiding this comment

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

You defined timerInterval with this.timerInterval, so on this line it will evaluate to undefined since you did not include 'this' keyword

class DivElement extends HTMLElement {
constructor(content) {
super('div', content);
// this.content = content;
Copy link

Choose a reason for hiding this comment

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

Good!

@MadEste
Copy link

MadEste commented Apr 27, 2019

Glad you got the tests to run, the intent of the assignment was to complete the tasks and get all tests to pass. You can ignore most of the warnings but try to get tests to pass. They include line numbers telling you where and why the tests failed. Read my comments for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants