Category "javascript"

NextJs Tailwind build (purge) removes all styling

In my current NextJS project, I am using Tailwind as a CSS framework. When I run yarn dev, everything works fine, but whenever I run yarn build followed by a ya

Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference

Given the following examples, why is outerScopeVar undefined in all cases? var outerScopeVar; var img = document.createElement('img'); img.onload = function()

What are the components in Angular.js?

I was reading about components and directives in angular.js but I couldn't get the exact difference between these two and also I want to know about the advantag

How to make the `import` statement work properly inside the code created using the node:vm module?

In our project we have the custom console object which is used as a logger. So we need to replace the default console. For this purpose we decided to use the vm

Intercept the same API call multiple times in Cypress

Is it possible to use cy.intercept to intercept the same API call multiple times in the same test? I tried the following: cy.intercept({ pathname: "/url", metho

Strip hashtags from string using JavaScript

I have a string that may contains Twitter hashtags. I'd like to strip it from the string. How should I do this? I'm trying to use the RegExp class but it doesn'

How to sync/link 2 bootstrap 5 carousels

I have 2 Bootstrap 5 carousels (carousel-a & carousel-b) on one page and i wloud like them to be synced/linked to eachother. I think this can be done with j

bug when adding a month with date-fns add() method?

I've been trying to add just one month to a date using date-fns add() function. It works as advertised most of the time. period = new Date('2021-03-01') //im a

Google chrome DOMException: Permission denied by system for navigator.mediaDevices.getUserMedia

It's November of 2019, this JavaScript code works in FireFox (70.0.1 (64-bit)), Safari (13.0.2 (15608.2.30.1.1)), Opera (Version:65.0.3467.48), On a Windows

change booleans to true and false with if using websocket and vue

I am new to websockets and for my project I'm using websocket what I'm trying to achieve is having two taps and when a user clicks the button Start the div with

React Table filtering data fetched from API

I am working with the react-table. Using data from API then storing into the state. I don't have a good idea for filtering data. I have a table with pagination,

How to count amount of reactions in Discord.js v13?

I have tried so many things out, here's my current code var green = toString(msg.reactions.cache.get('🟩').count); var red = toString(msg

Same Vue.js component in two browser tabs make <select> mirror its selected values

I have a Vue app, using vue-router and a few components rendered in x-templates. In one of those markup templates I have a < select > object. When I open

How does Typescript know where dist/index.js is, if it doesn't exist?

There is something I don't understand about this. I am trying to learn Typescript and I got me this boilerplate code using Snowpack and it contains an index.htm

ReactJS API call - Need redirect URL in response from request with 30X status without redirecting

I have an API which returns 30X response and redirects to a specific URL. But, I want to get redirect URL from response without redirection. I am using this in

I have an <Add /> component that is called in two different pages, but only one of them is receiving the add count prop passed to it in React JS

Please help me understand why this logic is not working on one of the instances of my counter button. My goal is to have my counter display the count like this:

Trying to see if I can run the same Slack message payload multiple times in Google scripts via data from a spreed sheet

I have a spreadsheet of data where I pull data from an array of data. After I declare the data, I run the code and it sends a message to slack using their block

TypeError: targetchannel.send is not a function

Node version : v16.13.1 Discord.js version : 13.3.1 TypeError: targetchannel.send is not a function How to fix this Error? Code: fs.readdir('channels', functio

Inserting a variable string inside my regex is not working in javascript [NOT a duplicate]

Hi, I have this code: var regcat = /\b(aa1)[a-z]\d+[.][g][i][f]\b/; var testit = "aa1a2.gif"; console.log(regcat.test(testit)); it produces TRUE as expected b

Error: ENOENT: no such file or directory, open

I am learning apollo. When I run my code it showing this error on my browser I don't know if it is my browser's problem. can anyone help me fix this Error messa