Well, I'm developing an app with ionic 3. As I try to write some data to the array, "\ n" appears at the beginning and at the end of the array. Here is the code:
element = this.pedido.produto;
if (this.vetCarrinhoAux.indexOf(element) === -1) {
this.vetCarrinho.push(element);
localStorage.setItem("vetor", JSON.stringify(this.vetCarrinho));
In LocalStorage, it looks like this:
[\n celular \n]