Both firefox and safari refuses to execute load event when loaded from an external js file. It only works on google chrome. I can’t really understand the problem. in my html : in myFile.js : My html page is serverd by node.js (ejs page), myFile.js is recognized by the 3 browsers (Firefox, chrome & s…
How can I get the access of a const inside my function?
How can I grant access to my const to be used inside a function? In this case I want to access my const catName inside my function fetchListings. I’m getting this error: Question Updated: Answer The problem you are running into is coming from how the <script context=”module”> works. Th…
which is the correct way to acces the props? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I think I’m not accessing the property src correctly, this can be found in all the obje…
Canvas API implementation
I recently started to learn a bit about how javascript work under the hood, and came to know that (in the context of chrome) v8 engine and web APIs are different. Here’s some questions I have regarding the canvas API specifically: Why do we need to use getImageData() every time we want to access the pix…
Dropdown on click doing nothing
I am just starting JS, so this may be a stupid question. I want to make a dropdown, where if you pick one option the related paragraph would be visible. I didn’t really know how to start this so I created the cars function to make the “e38value” paragraph visible when clicking the e38 button…
Define global variables to use inside components
I have a Laravel 8 project, with vue-sweetalert2 installed. I’d like to define the Toast behaviour once, and then call it inside my components. By now I have this code: /js/components/Mypage.vue This works fine, of course, but as you can see Toast is defined inside the method, and I cannot re-use it som…
How can I convert a JavaScript BigInt value to Scientific Notation?
I would like to render a JavaScript bigint value to a string in scientific notation. I thought of Number.toExponential() but it only works for numbers. Answer Intl does support Bigint: Turns out BigInt.prototype.toLocaleString() can be used with an options for scientific-notation: Original answer: (This code …
How to filter array with multiple conditions in Vuejs?
I am trying to achieve functionality like, Initially the array will be loaded with the help of v-for. At the top I have two options called search-bar and dropdown. Where With the help of those I am trying to filler the array. Where with search-bar, I want to filter array values. With dropdown, I want to filte…
React-Redux: Data not read during initial render in useState
I am trying to get a list of data called packages and put it in a table. Added filter and sorting to it. I get packages from pakageList reducer Assign to data state Then add soring and filtering logic and assign data to variable called filteredPackages Everything seems fine but when the page initially loads t…
Error when attempting to call smart contract with javascript
I am trying to write a piece of javascript that calls a smart contract. The smart contract has been deployed to a local test net with truffle and ganache and the javascript is producing the following error: Javascript code: Solidity code: I am not sure if the issue is coming from me not handling the async req…