JS Built-ins
FormDatabeginner

FormData Constructor β€” append and get

πŸ“– Usage Example
const fd = new FormData()
fd.set('a', '1')
fd.set('a', '2')
fd.get('a')  // β†’ '2'

set() replaces any existing values for a key; append() does not.

FormData append and get

After appending a key/value pair you can retrieve it with get().

Challenge: Append key 'k' with value 'v' to a new FormData, then retrieve it with get.

πŸ’‘ Hints (1)
  • β€’ append(name, value) adds an entry; get(name) retrieves the first match