Copy link to clipboard
Copied
Hi Experts
I need the Maximum Integer to include in my script so Instead of 1000
for (var i = 0; i < 1000; i++)
it will be :
for (var i = 0; i < MaxInteger; i++)
I Searched the InDesign DOM but not find anythig!, Please Help
Thanks in Advance
Regards
M.Hasanain
Mohammad Hasanin
1 Correct answer
Oh, you want:
var maxNum = Number.MAX_VALUE;
Not sure why, though...it is very large.
Copy link to clipboard
Copied
A bit unclear. Assuming your Array is all integers, then you need to sort it then get the last entry. Sort() will not give you max by default; you need to roll your own. From this stack exchange:
var numArray = [104, 140000, 99];
numArray.sort(function(a, b) {
return a - b;
});var maxInteger = numArray.pop();
Copy link to clipboard
Copied
Thank you Mr.brianp311, what i mean that instead of using limited number like 1000 or 2000, etc i want the array to loop to maximum allowed integer number in indesign javascript! maybe it will be million? as i assuming!, do you think there are a method for that?
Regards
M.Hasanain
Mohammad Hasanin
Copy link to clipboard
Copied
Oh, you want:
var maxNum = Number.MAX_VALUE;
Not sure why, though...it is very large.
Copy link to clipboard
Copied
Thank you very much Mr.brianp311
I need the maximum value because i make a script that will help you to start numbering in different way, so i dont want to limit the user with maximum number, thank you a lot
Regards
M.Hasanain
Mohammad Hasanin
Copy link to clipboard
Copied
I am not sure what you are trying to achieve, if it's about iterating your array then array.length should work.
-Manan
Copy link to clipboard
Copied
Thank you a lot for your Help Mr.Manan Joshi, i will try this also
Regards
M.Hasanain
Mohammad Hasanin

