Skip to content

Tag: javascript

Discord bot only replying to initator

I am starting with a new Discord bot using discord.js. I am still learning things but am curious if it is possible to send a reply to only the initiator, not the channel. Channel.send and message.reply are both public to all. Answer To dm the person who said the message do To send it to someone else,

Picking a random item from array with equal distribution

I want to pick a random item from an array at random. Is the way to go, but as far as I know this will cause a Uniform distribution to occur which means that the average is (lowbound+upperbound)/2 translated to an array with 10 elements the lower bound is the first element and the upper bound is the last elem…

Load HTML page in a service with its own CSS Angular

I have a Service, PrintService that I have added to my application. The Service extracts elements from a page and renders another window with the contents of the extracted elements. This works. Print Service on Stackblitz My Problem now is this, I need to be remove the css styles from the service above to its…

Javascript How to filter through nested array data

I have a search field which filters through an array when I’m typing. So far it works ok, but I cannot search within the “courses” array! How can I achieve this? The complete array looks like this: Here is my JS code so far, where I can search through all fields, except the “courses&#8…