Which is the right way of declaring a global javascript variable? The way I\'m trying it, doesn\'t work
$(document).ready(function() {
var intro;
i
If you're declaring a global variable, you might want to use a namespace of some kind. Just declare the namespace outside, then you can throw whatever you want into it. Like this...
var MyProject = {};
$(document).ready(function() {
MyProject.intro = "";
MyProject.intro = "something";
});
console.log(MyProject.intro); // "something"