+ 1

Hey guys,am In a process of creating a calculator to calculate surface area of a closed cylinder but my JavaScript has a problem

JavaScript calculate function

30th Jan 2020, 12:31 PM
louis wambua
louis wambua - avatar
12 Respuestas
+ 3
Hi! can I ask you to show us your code? otherwise, it's just guessing on coffee grounds. describe the problem more specifically
30th Jan 2020, 4:24 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
The formula is true but when I reload the code in my browser nothing seems functioning ,am trying to create a calculator
30th Jan 2020, 5:45 PM
louis wambua
louis wambua - avatar
+ 1
Var num1=document.getElementById('radius'); Var num2=document.getElementById('height'); document.getElementById('result'). innerHTML=2*Math.PI*num1*num2+2*Math.PI*num1*num2;
30th Jan 2020, 5:24 PM
louis wambua
louis wambua - avatar
+ 1
I run your code... and... fine news! He works (in generally)😁
30th Jan 2020, 5:34 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Hey bros would you mind sending a pic of it to my WhatsApp?
30th Jan 2020, 5:38 PM
louis wambua
louis wambua - avatar
+ 1
your code produces the result, as far as your formula is true however, I omitted the complex getElementById construction and used the usual prompt for input. Are you familiar with this built-in feature?
30th Jan 2020, 5:38 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
I run it in my laptop but nothing was showing up😔
30th Jan 2020, 5:39 PM
louis wambua
louis wambua - avatar
+ 1
to tell the truth, no, I can't. I modified it a little. so it will probably not suit you fully. but I can point out some errors to you. do you know how to use the coding platform that is located here?
30th Jan 2020, 5:41 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Yes I know
30th Jan 2020, 5:43 PM
louis wambua
louis wambua - avatar
+ 1
your first mistake is in declaring variables. how does this happen? and Yes, place your code in the "codes {}" section. select this option, click the plus sign, select web, and drop your code there
30th Jan 2020, 5:48 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Would you mind sending me your WhatsApp number so I send you a pic of the code from my laptop right now?
30th Jan 2020, 5:59 PM
louis wambua
louis wambua - avatar
0
Then the function before the code is window.onload(){ function calculate (){ //The code above goes here } }
30th Jan 2020, 5:26 PM
louis wambua
louis wambua - avatar