diff --git a/js/script.js b/js/script.js index 8b13789..bafbc6f 100644 --- a/js/script.js +++ b/js/script.js @@ -1 +1,13 @@ - +let celsius = document.getElementById("celsius"); +let fahrenheit = document.getElementById("fahrenheit"); + +function celToFar(){ + let output = ( parseFloat(celsius.value) * 9/5 ) + 32; + fahrenheit.value = parseFloat(output.toFixed(2)); +} + +function farToCel(){ + let output = ( parseFloat(fahrenheit.value) - 32) * 5/9; + celsius.value = parseFloat( output.toFixed(2)); + console.log(output); +} \ No newline at end of file