Skip to content

Category: Questions

How do I run additional JS function after calling location.reload()?

I am trying to run some code that refreshes the webpage, and THEN does the console log. The issue is the console.log is happening before the page reload. How do I adjust this to get the desired behavior? Answer The very act of refreshing a web page ends execution of scripts on that page, apart from what might…

Javascript Unerror method using another js file

<img src=”images/business-card.webp” onerror=”this.onerror=null; this.src=’images/business-card.jpg’ ” class=”m-auto img-fluid”> I want to write this feature from within js file. How can i do it ? Answer First, create the image in javascript: Now, add an o…

How can I update some array entries to have multiple values?

I have an array as such: I want to be able to add further information to this array, eg: I’ve tried a few different things like: With no results (or errors). Is there a way to do this? Or a better way of handling this issue? Answer I’m not entirely certain what you’re going for here since yo…