Why is this simple global variable not working inside a function
var test_1 = "None";
$(function(){
console.log(test_1)
})
I am getting the result Undefined
Why is this simple global variable not working inside a function
var test_1 = "None";
$(function(){
console.log(test_1)
})
I am getting the result Undefined
Check, whether you have jquery or not. I have created a jsfiddle (https://jsfiddle.net/2kudvsr0/) for your code and its printing None
(desired output).
Just make sure you are executing your code once jQuery is imported successfully.