JS Built-ins
FormDataintermediate

FormData β€” append() keeps duplicate keys

πŸ“– Usage Example
const fd = new FormData()
fd.append('a', '1')
fd.append('a', '2')
fd.getAll('a')  // β†’ ['1', '2']

getAll() returns an array of all values for a key, including duplicates.

FormData.append() β€” duplicates

append adds a new entry even if the key already exists, so getAll can return multiple values.

Challenge: Append 'k' twice and verify getAll('k').length is 2.

πŸ’‘ Hints (1)
  • β€’ append() never removes existing entries; use set() if you want to replace them