Question: JavaScript function called gravitationalPull which will calculate and return the gravitational attraction between two objects.with the following header: function gravitationalPull (m1, m2, s) The equation

JavaScript function called gravitationalPull which will calculate and return the gravitational attraction between two objects.with the following header:

function gravitationalPull (m1, m2, s)

The equation to use is:

Where:

is the gravitational attraction (the value to be returned) (Newtons)

are the masses of the two objects (kg)

is the distance between the two objects (meters)

is the gravitational constant, 6.67408 10-11(m3kg-1s-2)

var G = 6.67408e-11;

function gravitationalPull (m1, m2, s)

{

var retval = (G * m1 * m2) / (s * s);

return retval;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!