JavaScript vérifie si la variable existe
if (typeof myVar !== 'undefined') {
// myVar is defined
}
Grepper
if (typeof myVar !== 'undefined') {
// myVar is defined
}
if (typeof variable !== 'undefined') {
// the variable is defined
}
//or
if (typeof variable === 'undefined') {
// variable is undefined
}