Will Hua
Will Hua

Reputation: 1748

Use Strict MeteorJS

Accidental Duplicate: Should I add "use strict" to my meteor files?

From what I understand, use strict is good practice in JavaScript.

Should I use this when building MeteorJS Apps? If I should, where should I include this statement?

If not, why not?

Upvotes: 2

Views: 510

Answers (2)

Ethaan
Ethaan

Reputation: 11376

Short answer YES

the its a good practice because MeteorJs at the end of the day is Javascript

where should I include this statement?

At the very top of each file.

Also @pfkurtz on this SO gives 2 methods to use it, im never test that options, but the answer have up votes so it could work.

This GitHub Issue its helpful too.

Upvotes: 4

bardzusny
bardzusny

Reputation: 3828

Yes, using strict mode is generally a very good habit that can save you plenty of trouble later on. To use it, just include this statement:

'use strict';

As first line of every .js file in your project.

Read more about why it's a good idea to use strict mode: "It's time to start using JavaScript in strict mode", "JavaScript's strict mode and why you should use it".

Upvotes: 4

Related Questions