Whenever we need an auto-increment functionality for JavaScript we can use this code. it's very easy and simple code.