Encoding spaces with the javascript encodeURIComponent function

javascript

Solution

Spaces encode to %20, I believe that's their ASCII character code.

However, developers have taken a shine to encoding spaces to + because it generates URLs that are readable and typeable by human beings.

Problem

Why does the JavaScript function `encodeURIComponent` encode spaces to the hex Unicode value `%20` instead of `+`. Should URI parameters not spaces to `+`? ­­­­­­­­­­­­­­­­­­­­­­­­­­­

Original source