At the moment I'm trying to wrap my head around the use case for declaring a Javascript variable but not initialising it right away. I understand that declaring a variable will store/set aside memory to that variable for future use, but what's the point in declaring a variable and not initialising it immediately?
My first thought would be a use case where you'd want to declare a variable to use in multiple functions, or for creating multiple objects, like so:
var me;
function firstMe(){
var me = "Ryan";
//do something...
}
function secondMe(){
var me = "Bob";
//do something...
}
Is it good practice to work with variables like this? What are the situations in which declaring a variable and not initialising it are useful or preferred?