M
M
msdoc112021-11-02 19:48:55
Vue.js
msdoc11, 2021-11-02 19:48:55

It is displayed as an array, how to remove brackets and quotes?

Hello, there is a code:

selectedItemsSize: function () {
      return this.products.filter(function (item) {
        return this.sizes.includes(item.size);
      }, this);
    },

and in the template for the output of the result:
{{ sizes }}

When clicking on the checkbox, I use this code to display what sizes were selected. Output example:
[ "M", "L", "XL"]
And empty brackets are also initially shown []

How to remove these brackets and quotes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-11-02
@msdoc11

What's up with Vue? You display an array - you are shown an array.
If you want to have a string - make a string from the array. At least through .toString(), or somehow more specifically.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question