Computer Science, asked by arje4196, 1 year ago

Write the equivalent JavaScript statements for the following: (a) Area = 3.14r2 (b) KE = ½ mv2

Answers

Answered by shilpa85475
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