JSFiddle - React, Tailwind, and code Playground

by Mathias Bynens

JavaScript

var x = function(
  a // an anchor element
){
  return function( // return a function
    b,             // that takes a URL.
    c,             // (placeholder)
    d              // (placeholder)
  ){
    a.href = b;    // set the target of the link to the URL, and
    c = {};        // create a hash to be returned.
    for (          // for each
      d            // property
      in a         // of the anchor,
    ) {
        console.log(""+a[d], a[d], a[d] === ""+a[d]);
        if (         // if
      a[d] === ""+a[d]
    ) c[d]         // add it
      = a[d];      // to the return object
    
    }
    return c       // return the object
  }
}(
  document         // auto-run with
    .createElement // a cached anchor element
    ("a")
);

x('http://google.com/foo?q=lol&f=bar#hashwat');