Questions tagged [javascript]

JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, object-oriented, prototype-based, weakly-typed, and interpreted language used for both client-side and server-side scripting. Its primary use is in the rendering and manipulation of web pages. Use this tag for questions regarding ECMAScript and its various dialects/implementations (excluding ActionScript and Google-Apps-Script).

Filter by
Sorted by
Tagged with
0
votes
1answer
12 views

Calling a function inside forEach

//Array of books const books = [{ title: 'The subtle art of not giving a fuck', author: 'Mark Manson' },{ title: 'Everything is fucked', author: 'Mark Manson' },{ title: '...
0
votes
0answers
5 views

Issue using onchange and onclick on the same v-slider vuetify

I tried to create an onchange event on v-slider to update the value of slider.Then I create another click event on the same element to go to another page and the functions worked fine.Problem is ...
0
votes
1answer
13 views

Convert from JavaScript to Go

I know nothing about JavaScript. Assume that v contains a list of positive integers, vi is an index value, say current vi = 0. I would like to know how to convert v.splice(vi, 1) to Golang Is ....
0
votes
0answers
11 views

Exploding tier 2 element of a PHP/Typescript array

I have this PHP code which is formatting the array for me, $data = $dataQuery->fetchAll(PDO::FETCH_ASSOC); if(count($data)){ $data_arr=array(); $data_arr["records"]=array()...
1
vote
1answer
18 views

What's the difference between useState(function_name), useState(function_name()), useState(()=>function_name()) and useState(()=>function_name)?

The function createHiveBackground returns an array of objects that I want to assign to a state. Later in my application I'm going to use setHive to change some values of the array. What is the ...
2
votes
1answer
15 views

Injecting jQuery using bookmarklet not working on a page

I was trying to use this bookmarklet: javascript:void((function(doc){if(typeof jQuery=='undefined'){var script_jQuery=document.createElement('script');script_jQuery.setAttribute('src','https://code....
0
votes
0answers
19 views

How to lazy load remote data with React

I'm fairly new to React and I'm trying to lazy load a markdown file stored on the server. I've tried setting up an async arrow function that fetches the file and runs it through marked. I found this ...
0
votes
1answer
15 views

After adding browser-router, I am getting warning

Trying to create a ReactNav using create-react-app, just the second after adding the browserRouter, I am getting the warning: Element type is invalid: expected a string (for built-in components) ...
-3
votes
1answer
35 views

Why so many programming(javascript) examples use number 42? [on hold]

Why do so many javascript examples or tutorials use number 42? And I could find many other cases using a number 42 in the example. Are there any special reasons??
-1
votes
0answers
22 views

Select overloaded method with subclass parameter type when passing parent type

looking for some advice on good practice. I'm creating a collision detection system for a game programmed in Javascript. An abstract Collider parent class extends several differently shaped collider ...
0
votes
0answers
15 views

Efficiently implementing pagination in postgres while avoiding duplicates?

Let's say you're making a site like reddit and you want to have infinitely scrolling posts (25 at a time, and 25 more loaded when you reach the bottom) The naive solution uses LIMIT AND OFFSET, but ...
0
votes
1answer
26 views

How do you stop setInterval from creating multiple instances on .load()'s? [duplicate]

When a user clicks a nav button on my site they call a .load(), i.e., $("#main_window").load("file.php"); If file.php contains JavaScript along with a setInterval timer then if a user clicks the nav ...
0
votes
0answers
12 views

React Native : state is getting undefined inside useCallBack hook function

State is getting undefined inside the useCallBack hook I think it is not getting scope to the state variable const [selectedLocation, setSelectedLocation] = useState() const selectLocationHandler = (...
0
votes
0answers
8 views

ask for user input for selenium

I'm trying to automate my workflow using selenium in nodejs. When accessing sellercentral.amazon.com it sends an OTP code to my phone. How can I ask for a prompt at nodejs so I can input the code? I'...
0
votes
0answers
9 views

React native video player error for wrong size

I am facing a issue in react-native-video-controls First of all here is my code for a single item of the Flatlist renderItem = ({item, index}) => { return( <View style={{width: ...
-1
votes
0answers
8 views

Parse image pixel coordinates from URL

Is it possible to parse a image's pixel coordinates from a URL? Possibly log each pixel coordinate and the hex value of that current pixel index using variables and forEach? var pixelcoord = foo.. ...
0
votes
1answer
15 views

Laravel url call usein javascript

This is my Laravel route Route::get('upload-question/{sugg_id}/upload/{question_id}', ['uses' => '[email protected]', 'role'=>['admin'], 'as' => 'upload.question.store']); I'm ...
0
votes
0answers
8 views

Building an application .APK with electron.js ? Possible?

i would like to create an application for drawing. I want to use ELECTRON.JS with html/JAVASCRIPT/CSS. But i'm asking myself a question : is it possible to put my app on the GooglePlayStore ? Is it ...
1
vote
1answer
30 views

is it possible to seal JS objects automatically?

I want to seal JavaScript objects as soon as they get created: 'use strict'; class Test { } const t = Object.seal(new Test()); t.p = true; // error! Is there a way to do it automatically, ...
0
votes
0answers
14 views

Checkbox list in Angular reactive/dynamic form

Trying to build out a reactive/dynamic form using Angular8, strugglign with rendering a group of checkboxes. I've followed the tutorial at https://angular.io/guide/dynamic-form, and have it up and ...
0
votes
2answers
24 views

html css jquery modal doesn't open in browser

I am trying to create a modal window when a button is clicked for registering users.I don't know what is wrong. The button gets clicked but modal window doesn't open. My code is like this <...
1
vote
0answers
16 views

How to resize shapes drawn on map based on zoom value with react-native-maps

I am using react-native-maps to integrate maps in my application. I want to show some sort of radar heading the direction the user is heading, i want to area covered of different distances like 1 km, ...
0
votes
0answers
9 views

(sqlite3.InterfaceError) Error binding parameter 4 - probably unsupported type

I'm not sure which part of the code is giving me the interface error. Any help is appreciated. This is what is being inserted that's not being passed through correctly: [SQL: INSERT INTO minutes (...
0
votes
2answers
31 views

How can I set length limit on Local Storage?

I want to limit Local-Storage length on just 5. So I made some Code. But I don't know how to deal with length limit. Already tried to use if ~ else in JavaScript Code. I think I have to use if ~ else....
0
votes
0answers
20 views

How to use Ajax on Laravel?

I made a JavaScript code to process my request search request using Ajax. So thus, my code is defined as the following: if(document.getElementById('category')){ document.getElementById('category')...
1
vote
1answer
10 views

How to change the data of an existing D3 visualization and perform a transition?

I have created a visualization elements with the following code and it display everything as expected: var linkTopicComments = vis.selectAll(".linktopics") .data(topicLinks) .enter().append("...
0
votes
0answers
11 views

Shallow mock extends React.Component<MyInterface,any> showing error

Getting below error while mocking component. Conversion of type '{ props: { index: number; AssignmentTitle: string; AssignmentDescription: string; AssignmentUtilizedHours: string; ...
0
votes
1answer
18 views

How to Image Crop And upload to Folder And Save Name in database Using Ajax And Jquery In Php

I want to crop And rezize Image and Upload In Folder For user registration and profile updations.Upload and Crop Image using PHP and jQuery. HTML Form with Image Upload Option with JQuery Croppie ...
0
votes
0answers
23 views

Reason behind placing undefined as a property to window object?

In JavaScript, there is a property undefined for window object. What is the use or reason for that. What is the problem in placing undefined independent as null. We cannot find window.null.
0
votes
0answers
15 views

Reuse multiple existing IIFEs in react app

I have IIFE functions for some of the library code in an legacy application that needs to work for IE10+ (No ES6 module loading, etc). However, I am starting to develop an React app that will be ...
1
vote
0answers
18 views

How to reverse a @keyframe animation on mouse off?

I need to reverse the wipe animation when the mouse moves off the button. Is there a way to do this in only CSS? I know I can reverse the animation, but I'm not sure where to put in the CSS file in ...
1
vote
1answer
29 views

(Javascript) Trying to allow a key press only once in hangman game when it is deemed to be incorrect

Please let me know if there is any additional information I can add to help make my problem more clear! Im trying to get my hangman game to not allow another key press of the same kind if it is ...
0
votes
0answers
9 views

How to solve encoding when piping file from NodeJs Cloud Function?

I'm attempting to pipe a file in Firebase bucket through a nodeJS cloud function to the client (browser). The client will use file-saver.js to start the download on the browser. This works well with ...
0
votes
0answers
12 views

Issues Embedding Instagram posts in React components

The issue I'm running into is that the picture from any given IG post is not showing. What's showing up is the faded user caption/symbols, and the "view this post on Instagram" caption. My assumption ...
0
votes
0answers
5 views

Sailsjs Javascript method not triggering on Modal button click

I am developing a Sailjs web application. At one place I have to show a modal window (bootstrap 4 modal-dialog class) showing a list of items to choose from. In addition to the 'Close' button, I added ...
0
votes
0answers
23 views

React hooks - How can I return a hook call from useMemo

Codesandbox link This will crash the sandbox browser tab pretty quickly https://stackblitz.com/edit/react-hook-form-use-memo You can see it better here. Just make sure to open the inspector before ...
0
votes
1answer
20 views

var x=document.getElementById(“mytext”).value;Why i change the value to innerHTMl or innerText,it do not work?

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <input type="text" id="mytext">...
0
votes
1answer
22 views

mapping json from a fetch function into setstate

I am trying to map a json response into a state, what I am trying to do is map all the children of this array no matter how many, as in skipping the first array and only show its children, here is ...
1
vote
0answers
20 views

How to deploy a static website to AWS S3 using nextjs

I am still new to React and I started writing a static website using Nextjs. But when I want to deploy to AWS S3 I have some problems. I used to use webpack only and when I type yarn build I get a ...
0
votes
1answer
23 views

Make height of list fill whole page

I am currently trying to make a page with a map on one half and a list on the other. I want to make the list height fill the entire page but I can't seem to find the right way to do so. I am using the ...
-3
votes
1answer
22 views

Chatroom application

I was wondering how I can create a local chatroom using a website / app that connects to a server which will only allow the users that are connected to the router(LAN) to be able to chat.
0
votes
0answers
11 views

How do I stop Javascript Foliotek's Croppie from overwriting previously cropped and uploaded images on the same page with the latest uploaded image

The scenario is I'm uploading and cropping up to 4 images to a page. Once an image is cropped, it will appear on the page. However, when i go to upload and crop a second image, this second image ...
0
votes
2answers
33 views

Using Filter Method to Remove Item from Array

I am new to React and I am trying to build a very basic timesheet tool, where users can add tasks into the application and save. I am using React as well as Typescript. So far I have my main ...
1
vote
3answers
39 views

How to detect changes in input text field and enable save button

I am trying to code a function where it detects changes in the text field and enables the save button. This is running in Visual Studio 2017, HTML , JavaScript (function () { var ...
0
votes
0answers
13 views

Cart Array is not updating correctly

I have a cart object with property items[] and want to update the ui when the user added a product button and the view cart is clicked a div is open with all the products in the cart.items[]; I ...
0
votes
1answer
24 views

Fetch data in array's order

I have an array which contains a list of IDs. With it, I'm trying to fetch some posts data from the WordPress REST API. I managed to retrieve the data I was looking for, but the issue I'm running into ...
0
votes
4answers
30 views

Is it possible to make a function that can manipulate the object inside a particular function?

Lets say we have a function that has an object inside it and more : function myFunc() { var obj = { "one" : "1", "two" : "2" }; // And more code is down here but our main focus is ...
0
votes
0answers
14 views

wordpress website, using cloudflare as CDN, CSS on the live site keeps disappearing and sometime css classes does not work when i inspect the element

I am working on a wordpress website, using cloudflare CDN. I have dev, staging and live site, where dev and staging works perfectly fine but live site works very weird, CSS on the site keeps ...
1
vote
0answers
25 views

Get an object with null values from an array of nested objects

I have an array of nested objects. How do I get an object with null values using only a particular key in the array of objects? let headers = [{ title: 'Arun', id: 'arunId', ...
-1
votes
1answer
18 views

TypeError: Cannot read property 'includes' of undefined: using a command Array in discord.js

Making a discord bot might get tagged as duplicate but I can't find anything that fixes this sort of problem. With this code: client.on('message', message => { if (!message.content....