javascripthtmlmicrosoft-edgecompatibilitydeploying

I would like to know why my website is not showing up on Edge? it's developed on JavaScript


Thing is someone told me that this "..." is not supported on Edge. There's something with the following code that has compatibility problems and the website is not showing up.

Here's the code:

    //<< Mapping  hash
    hash = {
        route: hash[0].split(/\//)[0],
        params: hash[0].split(/\//).slice(1),
        queryParams: hash.length > 1 ? hash[1] : "",
    }

    hash.queryParams = hash.queryParams?hash.queryParams.split(/&/).reduce((a, c, i) => {
        return {...a,...{[c.split(/=/)[0]]: c.split(/=/)[1]}}
    }, {}):{}; // I got to fix this (Reynald - 12: 35 pm)
    //>>

The problem is specially on the hash.queryParams = ....

I'm going to split the complete function with its property and every method used on it. I know I will get a larger way so Edge doesn't get any problem on reading the website.

hash.queryParams = hash.queryParams?hash.queryParams.split(/&/).reduce((a, c, i) => {
        return {...a,...{[c.split(/=/)[0]]: c.split(/=/)[1]}}
    }, {}):{}; // I got to fix this (Reynald - 12: 35 pm)```

Anything by the moment. The output is that the website should be rendered from an external file which has a JavaScript that is drawing the website on an index.html, what I mean is for example a main.js that is drawing at index.html and the main.js has connections to call every independent page with each corresponding file.


Solution

  • Seems that spread operators are not supported in Edge for destructuring, so whoever told you that was correct. Unless you want to deal with transpiling your code, you can try using Object.assign().

    Replace return {...a,...{[c.split(/=/)[0]]: c.split(/=/)[1]}} with something like:

    return Object.assign(a, {[c.split(/=/)[0]]: c.split(/=/)[1]})