Category "javascript"

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

Passing innerHTML value of ID as the ("string") reference for getSheetByName()

I making a schedule app with pages for each day of the week. There are pages for Mon-Fri. Each page pulls info from their corresponding sheet also labeled Mon-F

My JavaScript code is memory leaking, but I don't know how to fix

I have a Discord bot written in Nodejs (JavaScript), but I run into a memory leak issue recently. My code is using ~10GB memory, and it keep increasing. I run p

React-native spotify api call returning [Unhandled promise rejection: TypeError: undefined is not an object (evaluating 'data.items.name.map')]

Hey so I'm working on a react-native app that is using the spotify Api. I'm currently trying to call the endpoint which returns a users playlists. The way I wan

Cannot read properties of null (reading 'pulsate') in material-ui Button component

This is version of material-ui that I am using : "@mui/icons-material": "^5.5.1", "@mui/material": "^5.5.1", This is how I imported Button component : import B

How can I select a square of cells (any size) and snap to grid?

How can I add a mouse event to select a range (up and down/left and right) of cells in my grid? <!DOCTYPE html> <html lang="en"> <head>

Prevent going to the previous page on browser back button

I have a Next.js / React.js project I'm working on and I'm trying to redirect to a certain page when browser's back button is clicked. My approach is as follows

How do I fix with Next JS and Antd Design Styling not working?

Whenever I try to style Antd Design component ( Layout, Sider and so on ) but it doesn't seems to be working. Therefore there won't be any changes on them. But

Why is focus-visible applied on page load

If I understand correctly, focus-visible is only applied to an element if it is focused because of a keyboard interaction. However, in the following example, if