I want to shorten the conditions of a javascript if but I don’t know how I can achieve it code: I have the conditions defined in this way: I appreciate any help! 🙂 Answer You can remove all unnecessary parenthesis in your if condition: Other than that, there’s not really a clean, readable way to s…
Tag: javascript
ShouldI replace setTimeout with node schedule in nodejs
I want to stop players from entering a raffle starting from 11:55pm – 11:59pm every thursday, so I have to make sure the route for entering the raffle at this particular time is block. I decided to use node-schedule for every seconds to see what the result would look like, but I was able to access the r…
Discord bot loading but commands are not working
I’m making my first Discord bot and I’m following this tutorial playlist here: https://www.youtube.com/watch?v=j_sD9udZnCk&list=PLbbLC0BLaGjpyzN1rg-gK4dUqbn8eJQq4&ab_channel=CodeLyon But for some reason my bot will load, say the load message, and even set its custom status but none of the …
How to extract all arrays in json object
I have a json object which has a collection of countries. Each country can have multiple regions which are represented in an array. I want to get the regions only and put all regions into one list.However when I map the data it doesn’t put all the regions in a list. What am I missing here? Here is the c…
Passing Response data to chartjs
I want to pass this json response data to a chartjs horizontal bar using angular this is the response : I tried this using x axes and z axes of the horizontal bar of chart js using this code But it seems it doesont work because i alwyas have duplication with different colors like this: i want to regroupe each
How to access data souce Angular Material Table
I hope everyone is doing great. Im trying to render data to the table for a material table but I cant solve why it isnt working. When I want to assign the data to the datasource for the table to render it dosnt get the information. Would apprecaite if someone could look for a secound and see if something. Typ…
How to delete a single entry from my Realtime Firebase database in React Native?
I’m not quite sure how to delete a single entry in my Realtime database, each time I run the following, it deletes everything in that database: I do have the id (can see that with the console.log) and it matches what my firebase shows on the web console. But why is “remove” deleting the enti…
access node data and fill accordingly on observablehq forcegraph
I am accessing the following sample page on observablehq. Force directed graph At the moment the page colors node based on group. I am struggling to do the following: colorfill (with a specific colour) a node (or all nodes) based on a value of the node Any help? Thanks Answer The group accessor allows you to …
feathers js get custom attribute value
I’m first time using feathers and Sequelize. I want ask something for the example I have data user my expected return but I got all data user b Answer You can use the after hook to delete the properties that you don’t want to get. Or you can use the feathers.js common querying to deselect the spec…
why console.log inside the useEffect runs twice
i’m currently working with react project, which gets data from api and show it on the console. although i wrote the console.log() just one time inside the useEffect hooks (with the [articles] dependency ), the web browser’s console.log always shows the console.log two times like this: enter image …