JS Built-ins
GlobalFunctionsencodeURIComponentbeginner

encodeURIComponent β€” space encoding

πŸ“– Usage Example
encodeURIComponent('hello world')   // β†’ 'hello%20world'

encodeURIComponent() encodes all characters not in the unreserved set, including & and =.

encodeURIComponent

encodeURIComponent('hello world') encodes the space as %20.

Challenge: Verify the encoding.

πŸ’‘ Hints (1)
  • β€’ encodeURIComponent encodes more characters than encodeURI, including & and =.