Return function: return description of object

I need some help to figure out a return function in javascript.
I’ve got this code as shown below and I need to createa function that returns text to be shown on screen. The text is supposed to describe the object in the cart (in swedish).
Any help would be greatly appreciated!

class CartItem {
constructor(name, price, amount = 1) { = name;
this.price = price;
this.amount = amount;

prettyPrint() {
console.log("Cart item with " + this.amount + " " + + " costs " + this.price + " with a row total of " + this.rowTotal());

getFriendlyText() {
return ; //(’’ + this.amount + ’ x ’ + + ‘, ’ + this.price + ’ $. In total ’ + this.rowTotal() + ’ $’);

First you should find a way to store said items in the cart.
Next, you want to iterate over the items of the cart and create a console.log() to print out the item.
I assume you can do the swedish part on your own :wink:
You could store the objects in an array and use a for loop to iterate over them, passing each item to your function(s).
Which part is it exactly you need help with? :slight_smile:

Thank you for your reply :slight_smile:
I’m not trying to return the item in question in the console.log but on screen in the DOM and I’m struggling with the code that begins with “getFriendlyText()” and how to write it so that the return is the item added to the cart :slight_smile: