Questions tagged [javascript]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

Socket.io check if url contains http:// or https:// and make it clickable

I have been working on a chat application where users can enter a room and message each other. Everything is working fine, but I’ve noticed that when sending a message containing HTTP:// & HTTP:// ...
-1
votes
0answers
6 views

How nodejs handle really fast events

I have a nodejs process with 4 different websockets, each pushing thousand events each second. For each event I'm calling an async function which elaborate it. Does nodejs execute this function in ...
0
votes
0answers
14 views

How do I stack the images above the text?

I am trying to figure out how do I stack each of the images above the text? The way it is currently it is it produces each image on the same line as the associated text so I am trying to do the ...
0
votes
0answers
9 views

I would like to copy a section of pixels of a photo with JavaScript, and then divide into parts, how to do this to achieve bubble/magnify effect?

<img height="500" width="500"> <script> imgDimension = document.getElemetsByTagName('img')[0].? imgSection = ?.[?]; imageSection.imgSection = function ?(){} ...
0
votes
0answers
3 views

Print out datafield in a md file onto one line

Wondering if anyone can help me out in figuring a way to print out in one text box the results from a script I made to pull data from other text boxes. So far it's all worked out but on the last stage ...
1
vote
1answer
8 views

Error when multiplying input value in a variable

I have 2 lists (conversion from kilometers to miles etc.). When I'm trying to use input value to calculate (so "X * 1.609" for kilometers to miles) I have an error NaN. const inputPlace =...
0
votes
0answers
7 views

Regex 5 alphanumeric separated by dash

I want to create a RegExp validation in javascript for string which can have 5 parts of alphanumeric seperated by only 4 dash. ed87aceb-cc6f-4535-be4e-867ac15310ab Invalid entries are More than or ...
0
votes
0answers
3 views

collapse and expanding two Bootstrap menu opposite situation

I'm workin' on a website that has two different menus and both use Bootstrap. they have to work opposite of each other, I wanna write the code when clicking on one of the menus to expand, the other ...
1
vote
1answer
17 views

How to fix an invalid random string to make it JSON valid

In Javascript, I need to "fix" a string, supposed to be JSON valid but may not be. The string has the following format (the unknown part is marked with "<INVALID_CHARS>"): [ ...
-2
votes
0answers
8 views

Dynamic table using javascript?

add new button doesn't work if any existing row is deleted before adding delete button doesn't work for newly added rows checkbox on the top should select/remove all rows age column is an integer, ...
0
votes
0answers
7 views

Webpack 5 not bundling CSS url() asset modules

I'm trying to include a new font face in my React application. This is built using Webpack. I've followed the webpack documentation of font bundling, https://webpack.js.org/guides/asset-management/#...
0
votes
0answers
6 views

How can I retransmit a video?

Say there is website X which hosts a video on it's page. How could I possibly retransmit that video onto another player on another website? Phrased differently - how can I capture the original video ...
0
votes
0answers
8 views

Node JS: Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:211:20)

I'm trying to insert a big array of data in MySQL database with node.js. My code works correctly with small array about 300 elements, but when I insert an array with 1M elements I have the following ...
1
vote
0answers
8 views

Add (one below the other) and remove drop down lists (select element) inside javascript function

I have this javascript code. It is a group of drop down lists and two buttons (Add button and Remove button). This image is the initial display. When I click the "Add Item" button, I want ...
0
votes
1answer
5 views

getting duration of mp3 without javascript library or nodejs

I have an audio element in my html to which im feeding an mp3 file for every item in an array, that works fine. What i want to happen is that it loads its metadata and reads its duration, then ...
0
votes
0answers
9 views

How to load and get images in JS dynamically

I'm working on a small canvas game engine and rewriting a part of it that loads images. export default class Loader { images = {}; async init() { await this.loadImage("grid&...
0
votes
0answers
19 views

How do I convert a dropdown <Dropdown> to a list instead?

Currently, I have a dropdown menu that looks like the image below. It is using the <Dropdown> which is being imported. However, when I change the <Dropdown> to <ul> instead I am ...
-1
votes
0answers
20 views

anyone k now why i'm getting this error. uncaught TypeError?

I cant find the error on my code but I am getting an uncaught TypeError message everytime I run it. It says uncaught typeError: cannot read properties of undefined reading 'readyState' at ...
-1
votes
1answer
14 views

Hey I am trying to get 12.0 as answer but getting 12 how can i turn this number into a float,

As you can see I am trying to getting 12.0. But instead i am getting 12 how can i add a 0 and make this number to a float please help *JavaScript let a = 6.0; let b = 6.0; console.log(a);
-2
votes
0answers
13 views

Uncaught SyntaxError: Identifier 'Products' has already been declared

I want to make a Class that will fetch my products and stringify them but console says that Products is already defined. Can you help me? Thanks a lot. That's my code: //cart var cart = []; // ...
0
votes
0answers
7 views

Detect whether Japanese IME is active in input box in Javascript

Is there a way to detect whether a Japanese (or other language) input method editor is active when a user is typing into an input box in Javascript? I have an input box which responds to the enter key ...
0
votes
1answer
12 views

How to execute code after all rows of array has been read using Readline module

I am trying to input an array of strings to my program using readline module. an example: const readline = require('readline'); const r = readline.createInterface({ input: process.stdin, output: ...
0
votes
0answers
8 views

JS Regex - String with at least 6 characters, one digit and one number. No whitespaces, no special characters, and only letters and digits [duplicate]

I need a Regex expression for words with at least 6 characters only letters and digits at least one digit at least one letter I have been testing this one /^((?=.*\d)(?=.*[a-zA-Z]))\w{6,}$/ but ...
1
vote
0answers
15 views

JavaScript apply() and invocation context [duplicate]

I am currently learning JavaScript and I thought that I understood functions. Apparently not. I thought that, in the following code, first argument of apply() call, which is this, would evaluate to ...
-1
votes
0answers
12 views

Good afternoon, is there any way to receive information through bluetooth and send it to the backend? I use React-Native

Good afternoon, is there any way to receive information through bluetooth and send it to the backend? I use React-Native
0
votes
0answers
8 views

Electron/Node: How to know when a file is modified by an external application?

I'm building an application that allows editing text files using Electron and Typescript. The application has two main requirements: Supports AutoSave When an external app modifies the text file, the ...
0
votes
0answers
6 views

Electron - save canvas img to file on disk

I'm trying to create a GIF/PNG generator which would combine images from different arrays and create a new array that would be converted into zip file with PNG/GIF images. I currently hit the wall ...
0
votes
2answers
18 views

How create React Typescript component with required and optional values but required value without default value?

I have a lazy load component where I have 3 parameters: children: is a component to pass to the Suspense component. height: is the height for the LazyLoad component load icon. width: is the width for ...
-2
votes
0answers
8 views

Reactive programming in Frontend development RxJS advantages [closed]

I started learning about reactive programming, I have learned the paradigm and have gotten familiar with RxJS. I created a simple search engine bar using RxJS and vanilla JS with lodash in order to ...
0
votes
0answers
5 views

How to insert iframe with p tag inside Quill editor?

I'm using BlockEmbed from var BlockEmbed = Quill.import('blots/block/embed'); And my Image insertion code looks like this class Youtube extends BlockEmbed { static create(value) { var node = ...
0
votes
1answer
11 views

React component which returns a table throws error because of useMemo hook

I'm trying to build an app that has a main component which imports a tab component which based on the selected tab, loads a component or the other one. The problem appears because in that component, ...
0
votes
0answers
6 views

how to get javascript variables into django url

<a href="{% url 'main:projectdata' proname=pro.projectname n=state %}"></a> <script> var state = 'Done'; </script> how to pass javascript variable state into ...
2
votes
1answer
14 views

Implementing private video chat rooms onto a website

I want to implement a private video chat room software onto my website. Like Google Meet without the bells and whistles (just video calling with a shareable private link). I found an open source ...
0
votes
2answers
37 views

Trying to reverse order of four verses in javascript

I´m trying to write the necessary statements to print the four verses of the Programmer's Lament but in reverse order. I´m trying to learn more about code and doing some exercises, the verses are ones ...
0
votes
0answers
7 views

how to implement resumable large file upload in javascript and laravel

I am trying to implement large file upload with resumable.js and laravel-chunk-upload. Everything is working fine, that is I am able to upload large files properly but the problem is, if anything ...
0
votes
0answers
5 views

Problem spying on a typeorm rollbackTransaction() function with jest

I'm trying to spy on a function so I can check if it's being called inside a try/catch, but I can't do that check. I believe the problem is in the spy assembly, as it can connect to the database, ...
1
vote
1answer
12 views

Appending text to results of HTML form action search, one text box, 2 buttons, 2 possible results,

I used @John Strood's answer from here to build my current script. The below code is close to my need, I now just need to append text to the results. For example, appending site:imdb.com/title ...
0
votes
0answers
9 views

How to change the font size of the bullets of an unordered list item in draftjs?

I have a rich text editor built using draftjs. I implemented the functions for changing the font size, font family, and color of the text in the editor. I also implemented the functionality of adding ...
0
votes
1answer
18 views

How to run the same JQuery on a new page

I was wondering, is it ever possible to run a JQuery code on the next page (lets say Page 2) that is executed on another page before (lets say Page 1)? So lets say this block was executed on Page 1 ...
0
votes
1answer
28 views

How to pack a thing [e.g. array, object] in Javascript like in C++?

I would like to know how (and if this is possible) to pack arrays in JavaScript like in C++, because I would like to micro-optimise my code by packing an array. In C++ it looks like this: #pragma ...
-1
votes
0answers
8 views

Apollo/GraphQL error " Invariant Violation: Could not find "client" in the context or passed in as an option.."

I have a React/TypeScript GraphQL/Apollo app that connects with an API and retreives a list of products and displays them on the page. The app starts and works fine. However, when I run a test (Jest + ...
0
votes
0answers
6 views

FullWidthControl Google Maps

I'm building a map in React with GoogleMap Api and now I want to cutom my fullWidthControl. there is function that can I call instead the conrol? (Like the setZoom..) there is way to design the ...
0
votes
0answers
15 views

event listener in js is not working in phone?

EventListener not working in mobile. this script is working properly in PC but it's not working in mobile phone I have try onclick too then or other function but don't know why none of them working in ...
0
votes
1answer
26 views

Stop audio on click and play it again

I am using 2 custom buttons and using JavaScript to click the audio play and pause. I am using the below code for that: <img class="head-iconn" src="img/audio.png" onClick="...
0
votes
1answer
12 views

How do I extract a portion of a link passed as a parameter in javascript? [duplicate]

I have a link similar to https://app.ticketmaster.com/discovery/v2/events?apikey=xxxxxx&keyword=Sarah%20Jarosz&latlong=xx.xxxxx,-xxx.xxxx&radius=15&unit=miles&locale=* that is ...
0
votes
0answers
16 views

I want to change the array by receiving the values in real time

I used event bus to pass values in real time. However, although the selectPosts method operates asynchronously, I have heard that it is not always good to adjust the variable value using the event bus ...
0
votes
0answers
19 views

Detecting partial keyboard runs in RegEx

I am looking to capture partial keyboard runs in strings (in Javascript); specifically the length of the run when three or more characters. While I can do this if I know the starting letter – for ...
0
votes
0answers
8 views

Can I use anime.js in EJS files with Node?

Every time I try to pass the animation variable to the EJS file in app.js I am met with the following error: ReferenceError: NodeList is not defined at toArray (C:\Users\18317\Documents\Web ...
1
vote
2answers
32 views

My clone is cloning all the previous added items

So i have an MVC app, i want to clone the div with the tag class="item_details" but my problem is that when i clone 1 time everything is good, then i clone a second time but it will clone ...
0
votes
1answer
15 views

Nestjs Roles Decorator: Crazy behaviour with getting user out of payload data

I am just trying to implement my Roles Decorator in Nestjs. So far it went pretty well, until I wanted to compare the user of the payload data from the jwt-token to the required role. I can't explain ...

1
2 3 4 5
46033