Copy link to clipboard
Copied
Hi Experts
Im Wondering How do I Convert Long List in My Script to Small One?, I have a list of numbers Look like :
MyList = ["1", "2", "3", "4", "5", etc to----> ,"1000"]
So it is so long in the script , So how i can make it appear divided in Multiple Lines? My Question is How to make the multiple return automatically (it will create multiple lines of the list) ?
Thanks in Advance
Best
M.Hasanain
Maybe you could try the wrap feature of editors and define the no. of characters after which the code line has to be wrapped to the next line. You could use soft wrap if just the appearance of the line is what you need, but you don't want to insert an actual newline character. See the following
https://stackoverflow.com/questions/319925/difference-between-hard-wrap-and-soft-wrap
-Manan
Copy link to clipboard
Copied
I don't really understand but, ... a for loop?
var makeArr = function() {
var a = new Array(1000);
for (var i = 0; i < 1000; i++) {
a[i] = i + 1 + "";
}
return a;
}
var MyList = makeArr();
Otherwise, you can put as many return marks as you want in the code:
a =["1","2","3",
"4","5","6",
"7","8","9",
//Etc
];
Copy link to clipboard
Copied
Thanks Mr.brianp311 for your reply, yes the second answer is what i mean, so how i can put many return marks in my code autmatically ? Like you showed me here :
a =["1","2","3",
"4","5","6",
"7","8","9",
//Etc
];
Thank You again
Copy link to clipboard
Copied
If it's about splitting the array definition across multiple lines then you can try the following
var MyList = [1,
2,3,
4,
5]
alert(MyList)
-Manan
Copy link to clipboard
Copied
Thank You Mr.Manan But My Question is How to make the multiple return automatically ? do you think it can be done automatically?
Copy link to clipboard
Copied
Maybe you could try the wrap feature of editors and define the no. of characters after which the code line has to be wrapped to the next line. You could use soft wrap if just the appearance of the line is what you need, but you don't want to insert an actual newline character. See the following
https://stackoverflow.com/questions/319925/difference-between-hard-wrap-and-soft-wrap
-Manan
Copy link to clipboard
Copied
Thank you it Works from View Menu of the Editor (View > Word Wrap) -Shift + Ctrl + W
Copy link to clipboard
Copied
Thank You @brianp311 Thank You @Manan Joshi for your great Help
Best Regards
M.Hasanain