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

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -