URL को एन्कोडिंग के लिए इन दोनों में से किस विधि का उपयोग किया जाना चाहिए?
encodeURIऐसा नहीं होगा /: encodeURIComponent("ac/dc")=> ac%2Fdcऔर encodeURI("ac/dc")=>ac/dc
"encodeURIComponent() and encodeURI() encode a URI by replacing URL reserved characters with their UTF-8 encoding....They differ because encodeURI does not encode queryString or hash values...URLs do not allow many special characters, like spaces or slashes. However these special characters are part of life, so URL encoding was invented." स्रोत
encodeURIComponent differs from encodeURI as follows: जिसका शीर्षक है: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…