Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Browsing all 138134 articles
Browse latest View live

How can i initialize state by passing props from parent component to child...

I am trying to initialize state in child component (EditUser) by passing props from below parent component (App):class App extends React.Component{ state = { name: '', city: '', company: ''}; inApp =...

View Article


How to inspect file permissions served by Karma

I'm new to Karma. When I run npx karma start I see the following gets triggered: http://localhost:9876/ http://localhost:9876/socket.io/socket.io.js http://localhost:9876/karma.js...

View Article


Angular show data on the user screen based on the values from the form

I have to display the data on the screen based on the input received via radio buttons by applying certain conditions. I also need help with fetching the id of an object when the name attribute is...

View Article

Firestore Security Rules - Pass data to Firestore not through auth or write...

Here's the use case:Any user can put in their email address (e.g., no auth), and then Firestore checks if there is a user doc with that email:db.collection("users").where("email", "==", "USER_EMAIL")...

View Article

Why document.getElementById can't find my button from it's ID [closed]

First of all,my 1st time i try with button id="download" with my Javascript and it worked so i saved and today i return to this file and click this button then it not working.i so confuse i try to fix...

View Article


How do you group a list of transactions by the date they're created in react...

I have a JSON list of test transactions and I'm able to display them with the dates they were performed but I would like to be able to group these so that for instance all transactions that were...

View Article

Add AntD success message as a step in the firebase authentication process...

I am trying to figure out how to add an Ant Design message as a step in the firebase user authentication (sign up) and database creation for user document steps process.The AntD documentation shows how...

View Article

How do you iterate a JavaScript object in reverse order?

I have a nested object containing years and a publication identifier. How do I list the publications by year, latest to earliest? I read here that order of objects is predictable as of ES6. In my code,...

View Article


Discord.js: message.mentions.members.array() works fine untile the message...

I have the following code for a moderation bot in Discord.js.const Discord = require("discord.js"); const client = new Discord.Client(); const gekickt = new Discord.RichEmbed() .setColor("#AE0202")...

View Article


What is the proper way to work with nested iFrames and Elements in NightwatchJS?

Disclaimer: This is going to be a long question, so apologies up front.I'm working to get a more reliable UI Automation suite to run and execute for a project. However, there are some outstanding...

View Article

How to do a sort based on more than one thing

I have an array of objects that I need to sort based on two sets of criteria. let arr = [ { name: "GMC", postalCode: "23456" }, { name: "Tesla", postalCode: "12345" }, { name: "GMC", postalCode:...

View Article

Remove duplicates from array of objects but keep one property as an array

I have a collection like this:const data = [ {index: 1, number: 's1', uniqId: '123', city: 'LA'}, {index: 2, number: 's2', uniqId: '321', city: 'NY'}, {index: 3, number: 's3', uniqId: '123', city:...

View Article

Getting data from an API array in React

I have a React component that has to retrieve the items of an array containing objects that comes from an API. The array, favorites, is structured with items like this:0:Object _id:Object...

View Article


Best way to find duplicate lines in large string in JavaScript

What is the best way to find duplicate lines (that repeats more than one time) in string that contains more than 10 M lines? (I just try to keep array as string to save memory)For...

View Article

How can I multiply an HTML character entity reference or  ?

I would like to draw a rectangle with a function in JavaScript, and I need to multiply the HTML character entity reference   to draw the spaces between the sides.Can I save the character...

View Article


onclick and eventListener for a dropdown menu not working

I have this Dropdown class in which I want to create new element that ,well you guessed it,works exactly like a drop down menu:class Dropdown{ constructor(name,element,classNa){ this.classN = classNa;...

View Article

how to encode input text data in html before calling api using axios in...

In my react app i have lot of places where we collect data from end user but we haven't used forms anywhere .And at few places this input data goes as querystring in the uri and if we don't encode the...

View Article


Check if an element is present in an array that is property of an object

I'm using Lodash and I want to check if an element is present inside an array that is actually a property (in my case "feature") of an object that is itself part of an array. I tried with _.some and...

View Article

How to set the contact form 7 phone number format in ###-####-###

I am using contact form 7,I was wondering is there a way to set the Phone number when Put by the user is the format ###-####-###,By default, Thanks in advance

View Article

How to overcome the issues of scope when passing event listener callback...

This question already has an answer here:JavaScript closure inside loops – simple practical example 44 answersI have an array of objects that define aspects of some buttons, including a name and a...

View Article
Browsing all 138134 articles
Browse latest View live