Category "javascript"

Checking instanceof with a class

I have the following code: function Complex(real, imaginary) { let c = Object.create(Complex.methods); [c.real, c.imaginary] = [real, imaginary];

react toastify does not work it gives a div as it output

**as you can see i am trying to show toast by using toastify and i install it but still it not working and it gives a div when it render** import React, { useR

Jest with TypeScript (Backend - Node/Express) says Cannot use import statement outside a module

I am working on Jest tests for a Node/Express TypeScript backend. I recently learnt about global test setup which I am implementing to reduce similar variables

Node JS: execution-time-wise, is generating array of promises and then using Promise.all better than looping and instantly awaiting every task?

Suppose we have an array of objects that we have to upload to a cloud service, the service will do something with each object and the return a result. The servi

How to use non-ascii characters in the regex filter of the declarativeNetRequest API for a Google Chrome extension?

I am creating a Chrome extension but just found out that it's not possible to use non-ascii characters in the regex filter of the declarativeNetRequest API. Whi

Make jQuery code run on page-change and load

I have a jquery code that inserts and prepends breadcrumbs on certain pages. I'm injecting this code through a third party tool where I can write JS. I only wan

Can't access multiple parameters of getStaticPaths from getStaticProps , Nextjs/Apollo/Graphql

Below you can check the code. I'm trying to use Id to identify single content and use titles for links, when I console log params.title console: android-pagin

how do I make granular signals that works for properties of a whole pure class

I have a class that keeps input events and lets me query the state. class Input { btn() { return this._btn } _release() { this._btn = -1 } _press() { t

Is there a way to use a variable inside an arrow function but initialize it inside another function where the arrow function is also called? [duplicate]

I'm trying to access the variable c that is initialized inside myFunc when I call sum. let sum = (a,b) => { let result = a + b + c;

React render function doesn't render the returned components

When I execute npm start, it opens localhost:3000 but doesn't display anything, just a white page. Then, I tried to insert a paragraph inside <body> in in

overflowX:visible not working in react-infinite-scroll-component

So I created, the infinite scroll with second method (the scrollable component is the parrent element) and the content I am displaying might have overflow on wi

How to return a string with quotes on output [duplicate]

I wrote this code: function unusedDigits(numbers) { let s = numbers.join(''); let arr = s.split(''); let ch = ['0', '1', '2',

Nuxt image keeps breaking on page change

I have image displayed on my Nuxt page but anytime I navigate away from it back the image breaks and I do not know why. I have this in my code <img :src="bas

localStorage.getItem() doesn't retrieve data on page refresh - ReactJs (TypeScript)

I'm trying to create a to-do list app with ReactJs, working with localStorage the setItem() works fine but the getItem() doesn't return anything except empty ar

having trouble getting my bot to join voice channel and play music

error i get is Cannot read properties of undefined (reading 'join') code: const ytdl = require('ytdl-core'); const ytSearch = require('yt-search'); module.ex

How can I redirect login to current page in react js?

I create a single page application using react. I create protected route but after login, I can access login page after login. If I try to go login route I can

Can't find specific single user email query in Mongodb database?

API response show all user data in database to website UI const [product, setProduct] = useState([]); const [user] = useAuthState (auth) useEffect(() => {

Minified js file has unicode symbols like A-Za-zÀ-ÖØ-öø-ʸ̀֐ࠀ῿‎Ⰰ-﬜︀﹯﻽ which is breaking code

A third party minified js file that I am using for my project has unicode symbols like "A-Za-zÀ-ÖØ-ö&Atild

Iterate Object and replace values

I have this Object: { "data": { "success": true, "historical": true, "date": "2022-01-01", "base": "MXN", "rates": { "COFFEE": 0.021

Filter a Component from a textbox VueJS

Can we show and hide a component based on textbox value? I saw v-if can do conditional rendering, but when textbox is null, nothing appear. And when i any chara