javascript,const products = [, { id: 1, name: 'Product A', price: 100 },, { id: 2, name: 'Product B', price: 200 },, { id: 3, name: 'Product C', price: 300 },];,,let currentIndex = 0;,,function displayProduct() {, const product = products[currentIndex];, console.log(
ID: ${product.id}, Name: ${product.name}, Price: $${product.price});,},,function nextProduct() {, currentIndex = (currentIndex + 1) % products.length;, displayProduct();,},,// Initial display,displayProduct();,,// Example usage: Call nextProduct() to cycle through products,nextProduct(); // Displays the next product in the list,
``Powered By Z-BlogPHP 1.7.3
Copyright Your WebSite.Some Rights Reserved.