Skip to content

Finished lab, functional temperature calculator#1

Open
JRedden27 wants to merge 1 commit intoReturn-Ready-2021-JavaScript-Evening:mainfrom
JRedden27:main
Open

Finished lab, functional temperature calculator#1
JRedden27 wants to merge 1 commit intoReturn-Ready-2021-JavaScript-Evening:mainfrom
JRedden27:main

Conversation

@JRedden27
Copy link
Copy Markdown

No description provided.

@kburd kburd self-requested a review December 8, 2020 20:59
Copy link
Copy Markdown

@kburd kburd left a comment

Choose a reason for hiding this comment

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

Awesome! 100%

}

// HTML Editing (Not sure if this is the proper indenting style, but it helped me keep track of the code.)
document.getElementById("tempBody").innerHTML += `<div id="outerBorder" class ="card m-3"></div>`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would put some of the elements on the HTML, no need to generate the app title, scale dropdown, or input with the DOM

buttonCol.innerHTML += `<br><button id="tempButton" onclick ="farenheitDisplay(), fToC(), fToK(), fToR()" class="px-4 mt-2">Calculate</button>`;
} else if(dropDown.value == "celsius") {
buttonCol.innerHTML = "";
buttonCol.innerHTML += `<br><button id="tempButton" onclick ="celsiusDisplay(), cToF(), cToK(), cToR()" class="px-4 mt-2">Calculate</button>`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It would be better to have the button always call one function, say calculate() and in the calculate method you determine what values to display and how to calculate them

document.getElementById("farenheitValue").innerText = `${f} \xB0F`;
}

function kToC(k, c) {
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 can get the same result with less conversion methods, if you had a method to convert each scale in Fahrenheit and from Fahrenheit into the other three, you would only have 6 equations

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