Category "javascript"

How can I enable tailwind intelliSense outside of "className"?

I'm using the tailwind CSS intellisense vscode extension, and it seems to only work when typing inside a className property. I'm using a package called cntl ht

nextjs does not support an empty link - what is a workaround for this?

I want to use a <Link /> with no content inside of it within my app, but for whatever reason, if I don't pass any content to it I get the "multiple childr

How to do thousand comma separator for javascript calculator?

I'm trying to make a thousand comma separator for JavaScript calculator. But something works weird for me. Here is the code that should work: var commas = r

How can I rotate a vector 90 degrees into a perpendicular plane, and then 15 degrees free from that plane?

What I ultimately want is a vector, giving the direction of the green line in the image below, knowing only the position of the yellow and green dots. To be mor

JavaScript Function find and return largest number

I'm attempting to create a function that takes two numbers, finds the highest one, and returns that. When I run my code: <script type="text/JavaScript">

Preloading a .css file with NextJS

We are using NextJS and Material-UI for our site, and upon loading the pages, it gives a FOUC. I've narrowed the problem down to the fact that the JS loads fast

How to use ternary operator for a return in JS?

I have a function to check sums in an array : function checkSum(array, sum) { // array = [1,4,6,11] sum = 10 var answers = []; var map = new Map();

Cannot find module 'webpack' using webpack-dev-server

Trying to get familiar to chat apps using this tutorial. Everything looks good, but when I try to run npm run watch according to the directions in the end, I ge

How to specify maximum number of words OpenAI completion should return

How can I specify the number of words the Open AI completion should return? E.g imagine I ask the AI the question Who is Elon Musk? What parameter can I use t

Click <select> and <input> after page load

I am writing a Greasemonkey script to interact with orders on Shipstation.com. The script will select certain values in <select> and <input> element

Scroll to the last item of a mapped array

I have a Message component that displays all the messages(incoming and outgoing) in one thread. I would like the last message/a newly typed message/incoming mes

How to fetch multiple .json files with javascript?

I have multiple .json files and I want to fetch them so I can take information from them. Like user ID, name, salary... I know how to do one, but I need two of

Using ref with React.createElement

I've got a reusable heading component that allows me to pass a tag prop, creating any sort of heading (h1, h2, h3 etc). Here's that component: heading.tsx impor

How to make my Discord.js bot that leaves servers below a certain member count

I am making a discord.js bot and trying to get it verified! I want to make it so when you add it to a server and it has below 35 members it leaves it. This is s

Handling Promise rejection with catch while using await

I am using await to make the code cleaner, but I am not sure whether I am handling exceptions correctly. An example while using azure-devops-node-api; const foo

Dynamically access Vue component data variable names

edit: I have used a number in this example which was a bad idea, in the real program I'm not using numbers but names (eg name_abba, name_jef, name_john) I have

Web3Modal Injected Provider not showing in options

I have a problem using Web3Modal, the connect panel doesn't show the metamask provider. Here is the code: const providerOptions = { injected: {

How to open a select dropdown on hover using Bootstrap Vue

I need a way to trigger the <select> or <b-form-select> and display the list of dropdown options on mouse hover. Without using JQuery or any externa

Javascript Remove Negative Decimal Value From String

I am trying to remove the negative and positive decimal value from the string following script remove the positive decimal value from the string however negativ

JSDoc nested types not showing on VSCode

I have this code: typedefs.js /** * A UUID. * Example: 123e4567-e89b-12d3-a456-426655540000 * * @typedef {string} uuid */ /** * @typedef {Object} Notific