moment() function works in html but not in separate javascript file -


i have included moment.min.js in page

<script src="js/jquery.js"></script> <script src="js/modernizr.js"></script> <script src="js/moment.min.js"></script> <script src="js/fatcalc.js"></script> 

i can call

<script>document.write(moment());</script> 

and displays date fine on page.

but, when call within fatcalc.js

var date = moment(); 

i error:

'moment' not defined.

why can html page see it, not fatcalc.js file?

well, figured out. seems issue jshint don't understand adding top of script fixed it.

/*global moment:true */ 

Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -