Why is there no data in FormData?

  • 0
    I expect FormData with the added data to be output to the console, but it's empty.
    Can I get and output (name - value) in the console, or doesn't it work?
    let formData = new FormData();
                formData.append('name', 'value');
                console.log(formData);
    JavaScript Anonymous, Oct 15, 2019

  • 1 Answers
  • 0
    console.log(Object.fromEntries(formData.entries()));


    or

    console.log([...formData.entries()].reduce((accumulator, [key, value]) => {
    accumulator[key] = value;

    return accumulator;
    }, {}));
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!