I have this code:
if(post.link[k].type == 'post miniatura'){
var postMiniatura = post.link[k].href;
} else {
var postImage;
try {
postImage = post.media$image.url
} catch (error) {
s = post.content.$t;
a = s.indexOf("<img");
b = s.indexOf("src=\"", a);
c = s.indexOf("\"", b + 5);
d = s.substr(b + 5, c - b - 5);
if ((a != -1) && (b != -1) && (c != -1) && (d != "")) {
postImage = d
}
}
}
What I tried to do was: If post.link[k].type
is "post miniature" it executes the code and stops, that is, it does not execute the remainder after else
. But what happens is that even though post.link[k].type
is true, it executes the code after the else too. I wanted the one after this to be executed only if post.link[k].type
was not equal to "post miniature". What do I do? (I'm new to JS)