₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,330,103 members, 8,443,861 topics. Date: Sunday, 12 July 2026 at 04:12 PM

Toggle theme

Can Someone Help Me Explain This Code Line? - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingCan Someone Help Me Explain This Code Line? (1416 Views)

1 Reply (Go Down)

Can Someone Help Me Explain This Code Line? by BabyApple(op): 6:41pm On May 18, 2018
<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Functions</h2>

<p>This example calls a function to convert from Fahrenheit to Celsius:</p>
<p id="demo"></p>

<script>
function toCelsius(f) {
return (5/9) * (f-32);
}
document.getElementById("demo"wink.innerHTML = toCelsius(77);
</script>

</body>
</html>
Re: Can Someone Help Me Explain This Code Line? by Wryhder: 11:33pm On May 18, 2018
Which part of it, the JavaScript?
Re: Can Someone Help Me Explain This Code Line? by D34lw4p(m): 1:29am On May 19, 2018
This is a JavaScript and HTML code. The JavaScript code has a function that converts temperature from Fahrenheit to Celsius then the result of the operation is inserted into the HTML page.
Re: Can Someone Help Me Explain This Code Line? by BabyApple(op): 5:51am On May 19, 2018
i want detail explation on the javascript code. how do i do about it
Re: Can Someone Help Me Explain This Code Line? by mexzony: 10:14am On May 19, 2018
BabyApple:
i want detail explation on the javascript code. how do i do about it
Pick up a JavaScript book then.
Try JavaScript novice to ninja by Darren . Google it sha
The JavaScript part is just a simple function to convert temperatures.
The function is declared and then called and the result is put into a paragraph which we grab hold of with its given Id in this case called "demo".
The innerHTML is an inbuilt property used to insert text to html tags like the paragraph in this case .It can also be used to insert html elements by their tag.
Now go and study JavaScript.
Re: Can Someone Help Me Explain This Code Line? by Yanumo(m): 6:32am On May 20, 2018
you have called your as an event into the function.

so you have to create an input field that carries that event (f). Then create a button that calls the function itself. so as to convert from Fahrenheit to Celsius.

But what your does basically is to convert from one degree to another. And displays the result in the p element.
1 Reply

I Am Bored, I Just Tried This CodePlease,Help Explain This Code In CJava Programmers ,I Need Help Fixing This Code.234

How To Print Diamond With A Frame Using JavaI Need An Investor To Finance My App.Just Launched My First Android Game(reviews And Ratings Needed)