dj50
dj50

Reputation: 51

Aceessing variables inside a JS self invoking function

I'm trying to write a bookmarklet that augments the functionality of a website I frequently use. All the code of said website is in a single script encompassed in a self invoking function like so:

(function() {

  var exampleVar=1;

  // code

}).call(this);

I have no control over that website. How do I get the value of exampleVar from the console or from a bookmarklet?

Upvotes: 0

Views: 162

Answers (1)

t.niese
t.niese

Reputation: 40882

You can't, that's one of the purposes of scoping, to protect the variable form being accessed.

Upvotes: 0

Related Questions