Write the equivalent JavaScript statements for the following: (a) Area = 3.14r2 (b) KE = ½ mv2
Answers
Answered by
0
Code is given below
EXPLANATION:
a) This is an example of nested function. Function is nested inside another function. Like in the below code Square is inside Area.
function Area(r)
{
function Square(x)
{
return x*x;
}
return 3.14*Square(r);
}
b) var formula
var m=10
var v= 40
with (Math)
{
Formula= ½ *m*v*m*v
}
with (document)
{
write(“Kinetic energy is: “+formula+”<br>”);
}
Similar questions
Environmental Sciences,
6 months ago
Math,
6 months ago
Computer Science,
1 year ago
Chemistry,
1 year ago