Access function (and variable) outside class in the class in Javascript.

So I have this code:

function SomeFunction() {
	Debug.Log("Log");
}

class TestClass {
	var SomeVar : int = 0;
	function Foo() {
		SomeFunction();
	}
}

And I end up with this error:

BCE0005: Unknown identifier: 'SomeFunction'.

I can’t figure out what’s wrong.

Edit: Also I can’t access variables that are outside class. I need to get something from Unity like prefab etc.

You can’t access variables or functions outside a class. If you need something accessible from anywhere, you want a “static” utility class:

public static class Whatever() {
  public static function SomeFunction() {
  }
}

class Thing() {
  function One() { Whatever.SomeFunction(); }
}