Espresso
Espresso

Reputation: 5739

javascript operator ":! 0" - what does that mean in this assignment statement?

Not an expert in javascript.

What does this ternary looking operator in this assignment mean?

var E,I,w={localhost:!0,"127.0.0.1":!0,"0.0.0.0":!0};
function p(e,t){
  var n="";
 for(var r in t)n+="".concat(r,": ").concat(t[r],"; ");
 e?e.setAttribute("style",n):d=n
}

var E,I,w={localhost:!0,"127.0.0.1":!0,"0.0.0.0":!0};
function O(e){
  var t=w[document.location.hostname];
  if(e)return new i.default({APIUrl:e,setCookie:!t});
  if(t){u.default.setIsLocal(t);
  var n=localStorage.getItem("myUrl");
  return n&&u.default.setSiteURL(n),null
}
return new i.default({setCookie:!t})

}

Upvotes: 1

Views: 36

Answers (1)

John Kugelman
John Kugelman

Reputation: 361625

It's not a special operator, it's just weirdly written code. Let's put spaces in to make it clearer:

{localhost: !0, "127.0.0.1": !0, "0.0.0.0": !0}

It creates a dictionary with three keys each pointing to !0, which is an obfuscated way of writing true.

{localhost: true, "127.0.0.1": true, "0.0.0.0": true}

Upvotes: 2

Related Questions