1

I have a website with the following code:

(function() {
    var x = "Welcome!";
    var o = {"date": Date.now(), "elapsed": null};
})();

Is it possible to access the variables x and o (such as logging their value) from a browser console? If so, how?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Nick362880
  • 13
  • 3
  • All javascript can be exposed to the console. You can edit the source code in developer tools and add console.logs or add debugger/breakpoints. – Joelgullander Oct 24 '19 at 20:11
  • 2
    Not possible. That's (usually) the whole point of using an IIFE. You can always just put a breakpoint there and step through the code, though. – VLAZ Oct 24 '19 at 20:11

0 Answers0