A
A
Andrey Vasilev2019-12-02 17:04:47
JavaScript
Andrey Vasilev, 2019-12-02 17:04:47

How to write an array to JSON?

Good evening everyone.
I fill out the form, push all the values ​​into an array, then I need to write this array into JSON.
How can I implement this? (First time dealing with JSON)

let i = 0;
  let spisok = [];
  let prev;
  function sendSpisok(){
  while (i < 7){
    prev = $('.mess')[i];
    spisok.push(prev.value);
    $('.txt').append('<p class="txtp">' + spisok[i] + '</p>');
    i++;
  }
  console.log(spisok);
  spisok = [];
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2019-12-02
@dollar

JSON.stringify(spisok)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question