Question: HELP! I keep getting this error and cannot find it anywhere, anyone see the extra )??????? Error: SyntaxError: Unexpected token ) pic files are (warm.png
HELP! I keep getting this error and cannot find it anywhere, anyone see the extra ")"???????
Error: SyntaxError: Unexpected token )
pic files are (warm.png / cool.png / cold.png)
HTML:
Temperature Converter
JAVASCRIPT:
const celsius = document.getElementById("cInput"); const fahrenheit = document.getElementById("fInput"); const convertButton = document.getElementById("convertButton");
const errorMessage = document.getElementById("errorMessage"); const weatherImage = document.getElementById("weatherImage").src = "warm.png";
function convertCtoF(cInput){ fahrenheit = celsius * 9/5 +32; return fahrenheit; }
function convertFtoC(fInput){ celsius = (fahrenheit - 32) * 5/9; return celsius; }
function domLoaded(){ convertButton.addEventListener("click", function()){ if (celsius = " "){ convertFtoC(fahrenheit){ return parseFloat(fahrenheit); } else convertCtoF(celsius){ return parseFloat(celsius)} } celsius.addEventListener("keypress", function()){ fahrenheit = " "; } fahrenheit.addEventListener("keypress", function()){ celsius = " "; } } convertButton.addEventListener("click", convertFunction()){
function convertFunction(){ if(celsius){ convertCtoF(celsius) return fahrenheit; } else if (fahrenheit = 32 && fahrenheit
if(isNaN(parseFloat(celsius)){ errorMessage.innerHTML = (celsius + " is not a number") } else errorMessage.innerHTML = " "; } if (isNaN(parseFloat(fahrenheit)){ errorMessage.innerHTML = (fahrenheit + " is not a number")} else errorMessage.innerHTML = " "; }) }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
