I create several js file. Each containing different kinds of functions.
object.js
String.prototype.rTrim = string_RTrim;
function string_RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;
while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;
} //End While
return strTemp;
} //End Function
Validate.js file:
//import object.js // is this possible or any way?
function Validate(targetVal){
//I want to use following
var aResult = targetVal.rTrim();
}
Validate.java code uses function defined in object.js.
I can put all into one js file: this is not I want.
Is any idea or any proper or industry standard pattern for this kind of issue?