I am developing a webpage for myself where I am fetching links to tutorials using a API. The problem is, there are lots of links to click on.
Is there any way in JavaScript to divide the links in 3 groups and have 3 buttons where on click they open all the links in group? Like, "Open First 1/3", "Open Second 1/3" and "Open Last 1/3"?
I tried to divide the links.length with 3, but it gives me a the result in decimal, like when the links count is 31, I am getting 10.3333333333
.
I am really clueless here. Any help will be appreciated. I know this question sounds kind of Do It For Me type, but believe me, its not. Just guiding me to the proper direction would be enough.
Thanks
3
Answers
I think this would help.
You can create chunck of links telling the size:
due to the number of links is whole number, why don’t you round it up such as:
if you have 20 links, you divide your links into 7-7-6 ?
so you’ll do: