If you want to check whether an array x exists and create it if it doesn’t, you can do
x = ( typeof x != 'undefined' && x instanceof Array ) ? x : []
If you want to check whether an array x exists and create it if it doesn’t, you can do
x = ( typeof x != 'undefined' && x instanceof Array ) ? x : []