In JS, if I log a string to the console it is not showing properly ?
console.log(uniqueProducts); // console.log(\"uniqueProducts:\"+uniqueProducts);
You are trying to concatenate an object with a string. You can fix it one of two ways:
Remove + from the log call
+
console.log("uniqueProducts:", uniqueProducts );
You can use JSON.stringify to print the object as JSON:
JSON.stringify
console.log("uniqueProducts:", JSON.stringify(uniqueProducts));