I don't think that's ideal for generating unique ids, I'd suggest using UUIDs instead. They are globally unique, you will never get collisions.
If you make several calls of 'id_' + (new Date()).getTime() in the same millisecond, you will get duplicated ids.
You can easily create UUIDs using the uuid library:
const ids = Array.from({ length: 5}, () => uuid.v4());
console.log("Ids:", ids);
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.3.2/uuid.min.js" integrity="sha512-UNM1njAgOFUa74Z0bADwAq8gbTcqZC8Ej4xPSzpnh0l6KMevwvkBvbldF9uR++qKeJ+MOZHRjV1HZjoRvjDfNQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
You'll see that if you generate a bunch of ids at the same time they can easily be duplicates, so that approach will be very risky:
let ids = Array.from({ length: 5}, () => 'id_' + (new Date()).getTime());
console.log("IDS:", ids);