Jack Chi
Jack Chi

Reputation: 440

How do I use Meteor.js browser Javascript Console?

Launching new Meteor.js project. In client.js I put

var hi = "widget";

    if (Meteor.isClient()){
    ...
    }

In my Browser's Console, and I type:

>> hi
ReferenceError: hi is not defined
>> this.hi
undefined

Upvotes: 0

Views: 379

Answers (2)

Ilya S.
Ilya S.

Reputation: 11

Okay, this has changed just recently in version 0.6 and seems to be just a bug. If you remove var at the declaration of hi, the scope of the variable will change and it will become accessible via JS console. Still, it's a temporary situation, which will be likely be fixed in the future releases.

Upvotes: 0

Esailija
Esailija

Reputation: 140236

It is probably locally scoped.

Try:

var global = Function("return this")();
global.hi = "widget";

Upvotes: 1

Related Questions