I'm trying to set a variable:
latestPostId = posts[latestPost].post_id
But in one scenario, it is not defined yet. What is the best way to check?
I have tried these:
if (data.post_id !== undefined) {
if (data.post_id !== 'undefined') {
if (typeof data.post_id != 'undefined') {
But none seem to work. What is the best way to check if posts[latestPost].post_id
is defined?