Category "javascript"

Why is a transaction consuming gas for a public view function?

I deployed the following smart contract on Ropsten ethereum test network and afterwards I tried making a transaction using @alch/alchemy-web3 npm package (Yes,

SequelizeForeignKeyConstraintError on nested findOrCreate inside a loop

I am trying to insert multiple rows on 2 related tables using sequelize with mysql. Based on sequelize transaction cannot insert because of foreign key? I trie

Firebase: Firebase App named '[DEFAULT]' already exists with different options or config (app/duplicate-app)

I am a newbie, and I am stuck. I don`t know what to do. My browser is showing that fire store is not able to connect to the backend. This is my code : impor

Definition for rule 'react-hooks/exhaustive-deps' was not found

I am getting the following eslint error after adding // eslint-disable-next-line react-hooks/exhaustive-deps in my code. 8:14 error Definition for rule 'r

Prettier react/jsx-max-props-per-line format with VSCode

I use Prettier in JavaScript project with React. All my component props is formated in 1 line : <Icon icon="arrow-left" width={15} height={18} /> And i

Why is setInterval making infinite loops

I'm trying to set a timer so it display the seconds and min left of an user and I'm using setInterval to get the seconds and if there are 60 seconds it will red

Javascript bookmarklet for toggling webpage editing on/off?

I once saw a JavaScript bookmarklet on the internet, but I lost it. The bookmarklet does not specifically enable/disable the page editability, but it does togg

Toggle dark mode - Problem with newly created elements

I want to make JS dark mode toggle with click event but it works with HTML elements but it doesn't work with created elements with JavaScript using DOM. let

Ways to limit Phaser3 update rate?

In my Phaser3 game there is a global gameTick variable that is incremented every update. I am using this to spawn in enemies in my game every 100th update. Her

document.getElementById - dynamic use for using the same ID more than once

var img = document.getElementById('myImg'); var modalImg = document.getElementById("img01"); var captionText = document.getElementById("caption"); img.onclick

TypeError: res.status is not a function

I'm making a function that permits me to upload a picture to imgur in my express api (nodejs), i'm encoutering an error when calling a function returning a prom

XSS - Javascript String

Is it possible to perform an XSS on the following: <script> var name = "USER_INPUT";</script> where USER_INPUT is given by the user. I have a fil

tinymce automatic list items

I am using the tinymce lib. this is my code: <div class="beschreibung"></div> <script> tinymce.init({ selector: '.beschreibung', inline

Display an image from an api for 24 hours

I'm doing a project in React, and on my "Home.js" page I would like to display a pokemon randomly for 24 hours thanks to the PokeApi (https://pokeapi.co/). But

Check if the response of a get api is a proto object

I fetch a proto object from an api , is there anyway I can validate that the response is a proto object. One thing which I did was check content-type as mentio

Order array of objects based on dependencies list?

I need to order an array of objects, composed by a name and a dependencies list (made out of names). An example of this array could be: [ { name: 'a', requi

Order array of objects based on dependencies list?

I need to order an array of objects, composed by a name and a dependencies list (made out of names). An example of this array could be: [ { name: 'a', requi

Using lodash push to an array only if value doesn't exist?

I'm trying to make an array that if a value doesn't exist then it is added but however if the value is there I would like to remove that value from the array as

Could using native browser modal dialogs in a loop lead to potentially infinite execution?

I was trying some code at JSBin and got weird results. This should work - it's a simple loop that uses Window.prompt. It does execute the correct number of time

Javascript Regex to match value of JSON key value pair

Given the following key value pairs, how could I match just the values (including the quotes)? Explanation: I'm doing a find and replace in my IDE. I have hund