21 lines
613 B
Plaintext
21 lines
613 B
Plaintext
/* Introspection, in jsish */
|
|
if (Info.version() < Util.verConvert('2.8.6')) {
|
|
puts("need at least version 2.8.6 of jsish for this application");
|
|
exit(1);
|
|
}
|
|
|
|
/* Check for "abs()" as function and "bloop" as defined value, call if both check true */
|
|
if ((bloop != undefined) && (typeof Math.abs == 'function')) {
|
|
puts(Math.abs(bloop));
|
|
}
|
|
|
|
/* ECMAScript, this will sum all numeric values, not just strict integers */
|
|
var nums = 0, sums = 0, v;
|
|
for (v of Info.vars(this)) {
|
|
if (isFinite(this[v])) {
|
|
nums++;
|
|
sums += this[v];
|
|
}
|
|
}
|
|
printf("%d numerics with sum of: %d\n", nums, sums);
|