DEV Community

Cover image for How to generate an ID for Array sequentially ?!
Mohsen Fallahnejad
Mohsen Fallahnejad

Posted on • Updated on

How to generate an ID for Array sequentially ?!

All of us need to create objects or arrays to store different things at different times.
One of the important things in this section is to create a proper ID that will make the array more regular and easier to access to each component.
In different cases and depending on different conditions, the process of ID production may be different, But sequential ID generation is mostly used.

alt text

This statement creates the next target ID by taking the length of the array and obtaining ID of the last index.

This is the first post that Iā€™m writing in "Dev.to" and I hope to continue :)
If you found it useful, you can follow me and also visit my website, because there are more ways to connect with me. I hope this would help you to improve your coding skills. Thank you for your attention.


This article was originally published on The Dev.to on March 15, 2020 and was written by Mohsen Fallahnejad.

Top comments (0)