Since few days i am stuggling with some problem on img replace in javascript. I am coding this application with course, but in this course video img replacing work well. probably main cause is that I fetch other API. Its opportunity for me to learn how to solve this kind of problems but i can't find answer since few days.
Here is my code: https://codepen.io/sowicz/pen/xxjyXVO
And problem is in this lines below. Because of some serials data from json can't be load (GET 404 error) I want to replace img for some img from pixabay. Unfortunately it doesn't work. I can't solve this issue.
if(serials.Poster) {
imgSrc = serials.Poster;
} else {
this.imgSrc = "https://cdn.pixabay.com/photo/2022/03/31/11/28/snakes-head-fritillary-7102810__340.jpg"
}
I am very sorry if something is missing, I am new in coding. Thanks a lot in advance, and wish you good day!