Category "javascript"

Is it okey to use side effects in the useState hook callback?

Imagine situation: const [value, setValue] = useState(false); const setSomething = (val) => { setValue((prev) => { fn(); dispatch(action); // or an

Error when run in command line "npm install firebase"

C:\Users\user\Desktop\CarInventory>npm install firebase npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: 3d-reac

error handling javascript (paypal sandbox platform)

I am trying to build a PayPal sandbox platform with JavaScript, but unfortunately I did not find any working (at least for me) content from PayPal for setting u

How to do cartesian product with TypeScript?

Here's the type signature that I'm after: function cartesianProduct<T1, T2, T3, T4, T5, T6, T7, T8>([c1, c2, c3, c4, c5, c6, c7, c8]: [T1[], T2[], T3[], T

How can I use tsx in Vue Compostion setup function?

When I write tsx in @vue/composition-api setup(){}, just like <script lang="tsx"> import { defineComponent,} from '@vue/composition-api'; export defineC

how does $: in Svelte works

was reading a svelte tutorial, it's mentioned that $: this is regular in JavaScript, but don't understand it. let count = 0; $: doubled = count * 2; how would

Add eventlistener to multiple elements to execute multiple functions

I am trying to add an eventlistener to 2 objects but only get it to work with 1. There are 2 textinputs which both should execute 4 functions on input. The firs

How to drag points with it's connecting line in html5 canvas?

Following is my code. I have face issue when I drag a point. The problem is that whenever I drag point all the line connect to one point. I need to have draggab

How can I get key values and correspond it to each other in js?

I have an array of objects as follow: [ { "card_key": "Edition", "card_value": "Elite Fight Night" }, { "card_key": "Car

Script that returns _id in MongoDB with JavaScript

I need a javascript code that saves in a variable the _id I'm having trouble getting that _id because it’s inside an array. I have looked everywhere but I

how to submit a image with react-firebase-form in firebase?

const [photo,setPhot]=useState('') photo setPhoto(e.target.value)}/> const handleFormOnSubmit=e=>{ updateProfile({photoURL:photo}) const [photo,setPho

SVG.js How do I add an svg to the HTML page

I have a page that will show several svg images that will be generated from json data. I created a javascript class that will generate the svg but I don't know

localStorage array reset when added a new item

I'm currently working on a project where I have to store as many as players as needed into an array of players using localStorage. I'm in fact able to register

Create two dimensional array from two arrays

I've got these two arrays and I need to obtain c. I managed to obtain a solution with two fors and conditionals, but I'm sure something better than O^2 can be o

Change an audio file frequency into ultra-sonic sound frequency

I'm trying to change my audio file frequency in Javascript and after a lot of struggle I came to one solution, files are given below but I face one limitation h

How can I control daisyUI tailwind modal open as default

I set daisyUI but not figure out how to control modal by condition I think similar with flowbite or bootstrap https://flowbite.com/docs/components/modal/ but da

Javascript not executing immediately?

I have a javascript in a form of an extension on my Brave, that is connected to the authotkey commands, when I press a button the script will activate and const

Convert multiple images to base 64 using single function

I'm working on a problem where I have to take three images as input from the user and have to send them to the backend by converting them into Base64. I know ho

Please why is my code not working,do I need to install any library

Recently started functional programming and all explanations of the pipe and compose using reduce which I have seen are very sketchy. const x = 4 const add2 =

how to support Promises in Internet Explorer 11 using laravel mix?

I'm trying to figure out how to get laravel-mix to convert ES6 javascript code into javascript code Internet Explorer 11 can use. I've setup a brand new laravel