In Javascript, I can assign a global variable in different data types in different function scope. For example:
var a = 1;
function foo(){
a = a + 10; //a is number in foo
}
function bar(){
a = a + "hello"; //a is string in bar
foo(); //a is string in foo now
}
foo();
bar();
My example is just a simple demo and I believe most Javascript programmers won't write it. However, is there any practical usage for such dynamic feature that global variable changes its data type in different functions?