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

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -