Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

part 1 of js/homework#6

Open
anthonythuo2320 wants to merge 1 commit into
CodeYourFuture:masterfrom
anthonythuo2320:master
Open

part 1 of js/homework#6
anthonythuo2320 wants to merge 1 commit into
CodeYourFuture:masterfrom
anthonythuo2320:master

Conversation

@anthonythuo2320

Copy link
Copy Markdown

No description provided.

@Happy0 Happy0 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good work. You've shown a good understanding of manipulating DOM elements and using helper functions / for loops and if statements.

Comment thread js/main.js
// 2. Define your event handler (callback <-- function)
myButton.addEventListener('click', doSomething);

function doSomething(){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could rename this function to something describing what it does.

Maybe 'changePageElementColours' or something :P

Comment thread js/homework.js
function changeFontColor(element, colour) {
element.style.color = colour;
}
function jumbotronColor(element, colour) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You aren't using this function. Maybe you don't need it and it can be removed?

Comment thread js/homework.js
@@ -0,0 +1,44 @@


function changeBackgroundColour(element, colour, ) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the ',' after colour is not valid javascript. Maybe it breaks your function?

Comment thread js/homework.js

}
var myButtons = document.querySelectorAll('.colorButton');
for (var i = 0; i < myButtons.length; i++) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ha :). Nice use of a for loop and if statements in the 'changeColor' function.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants