JS Built-ins
FormDataintermediate

FormData β€” set() overwrites existing value

πŸ“– Usage Example
const fd = new FormData()
fd.append('q', 'hello')
fd.get('q')   // β†’ 'hello'
fd.get('z')   // β†’ null

get() retrieves the first value for a key, or null if absent.

FormData.set()

set(name, value) replaces all existing values for the key with the new one.

Challenge: Append 'k' -> 'v1', then set 'k' -> 'v2'. Verify get('k') is 'v2'.

πŸ’‘ Hints (1)
  • β€’ set() is different from append(): it replaces all existing entries for that name