How can I make a code in javascript and execute it in google chrome console that make a http proxy for me. To be more clear I am going to fetch the following code in my chrome dev but does not work. I expected that return my proxyserver's IP but it does not.
var proxyAgent = new HttpsProxyAgent('http://myproxyserver.com:3128');
fetch('https://httpbin.org/ip?json', { agent: proxyAgent}).then(response=>
response.text()).then(data=>{
console.log(data);
}).catch(error=>{
console.log(error);
});