I have created a lexer in javascript, and where im now using an array to describe a range of items, i now see the use of having my own Range object so i can properly distinguish an "array" and a "range array" in such a way that it reads nicely.
So is there any way i can create a hugely cross browser compatible sublcass of the Array object?
Or would a better/simpler approach just using array as is, and for "range arrays" i just tag the array with a property of my own choosing?
something like:
var myRange = [1,2,3];
myrange.isRangeObj = true;
//i would then use if(myRange.isRangeObj) to do specific range operations.
//However i still think myRange instanceof Range reads better
myRangevariable.if (typeof myRange=='object')perhaps ?