javascript, default object comparator

i have a simple buff class and a generic list full of buffs. and i need to sort them but the
reference for the list’s sort function says:

“Sorts the elements in the entire List using the default comparer.”

i need to override the default comparer in my buff class so they are sorted how i intended, but i’m not sure what function’s name is, so i can’t start to override it.

this is the class:

#pragma strict

class Buff
	var on: boolean;
	var name: String;
	var effect1: String;
	var effect2: String;
	var power1: float;
	var power2: float;
	var duration: float;
	function Buff(newName:String, e1: String, e2: String, p1: float, p2: float, dur:float)
		on = true;
		name = newName;
		effect1 = e1;
		effect2 = e2;
		power1 = p1;
		power2 = p2;
		duration = dur;

One way to achieve what you want, is to change your class so that it implements generic IComparable interface, and uses CompareTo function:

class Buff implements System.IComparable.<Buff>
    // all your class stuff
    function CompareTo(other : Buff)
        if(other == null)
            return 1;
        return this.power1.CompareTo(other.power1); // or any other suitable code to properly compare required values