How to check (eval?) if a given string/variable is valid
If I try
getData('/img/webshop/'+product.images[551].slug+'/'+product.images[1].src')
I get 'Cannot read property slug of undefined' if array item [551] does not exist
My getData function contains a Try catch function to check if [551] exists but the error is allready generated when the getData function is called
I could solve this by adding back-ticks
getData(`'/img/webshop/'+product.images[551].slug+'/'+product.images[1].src'`)
and sending this like a string but then I need to convert this string in getData, (eval?) but this doesn't work. ( remains string)