can you change this script ( c#) to javascript ?

Transform cubesParent = transform;
Rigidbody cubes = cubesParent.GetComponents();

foreach(Rigidbody cube in cubes)
    cube.rigidbody.mass = 50;

this is a good reference : What are the Syntax Differences in C# and Javascript? - Unity Answers

This is from the above link :

The Foreach keyword

C# Iterators use foreach instead of for. Also notice the variable declaration within the for/foreach statement. C# requires the type of the item contained in the list to be explicitly declared.

// Javascript
for (var item in someList) {
    item.DoSomething();
}

// C# 
foreach (ItemType item in someList)
{
    item.DoSomething();
}

Note though that the JavaScript version uses inefficient dynamic typing (since you *can't* declare the type). The static-typed alternative is:

// Javascript
for (var e=someList.GetEnumerator(); e.MoveNext();)
    e.Current.DoSomething();

I could convert it but you should be able to get it from here =]

(if you have probs, I can help)