Right now I have an array of object with children that also have an array of objects. I want to extract the children array and concat them to the parent array like below. What are someways to do this. I’m currently looping though the child array creating a new array checking if it’s not empty. It …
Tag: javascript
if the LI tag has a class of active it will go to the last position
I have multiple li tag, if the user clicks one of those tags it will have a class of active and then the li tag will go to the end position of the list. but if the user decided to click the li tag it will remove the class and the li tag will go back to the previous position.
Discord.js v12 Ban Command
I made a ban command for my discord.js v12 bot. However whenever I run the command I get an error. Here is my code: This is the error I get whenever I run the command I could’nt understand how to correct the problem in the code. I’m a bit new to coding. Can you please help me out!. Thanks in
Jest Unit test + received undefined
I am using Jest as my unit test framework. I am trying to mock third part npm “request” and executed my test cases, but i am receiving and the test fails The following is my code: spec.js Ctrl.js Please share your ideas. Thanks in adavnce. Answer You don’t need to use await with the callback…
Need assistance with Palindrome flip-card app! It’s not excuting the functions as planned
I’m made a Palindrome app that takes a word input and flips to say if it’s a palindrome or not. However, after inputting a word it’s not flipping the card to reveal if it’s a palindrome or not. I was using following the Multi-faced Flip Card with a Click by Maria del Carmen Santiago, p…
Vue.js pagination with http requests
I have table with pagination-nav component: I get table content using method getTrades with http request to json API: Where every ${page} corresponds certain slice of data. Server-side code and requests work fine. Now I want to pass page number from button clicked to method getTrades. For this purpose I call …
failed to load wasm application
I’m trying to host a website, and I use a .wasm file with .js scripts created by the wasm-pack tool. I tested the project locally with npm and node.js and everything worked fine. But Then I hosted it on a raspberry (apache2), and when I try to access it, I get in the following error: Failed to load modu…
expo FaceDetector keep triggering “onFacesDetected” event in “accurate” mode even without face
I’m new to react native. I’m using expo FaceDetector to detect faces. when I’m using it in “fast” mode it trigger “onFacesDetected” event correctly. But when I’m using “accurate” mode “onFacesDetected” event keep triggering (on “min…
Configure Vue loader and lazysizes to transform urls with Nuxt
I’m trying to configure lazysizes with Nuxt and my urls are not handled by Webpack so I get a 404 error. I get the path src=”~/assets/img.png” instead of src=”/_nuxt/assets/img.png”. I added lazysizes as an npm package and the following to my nuxt.config.js file. And this content…
using addEventListener or onclick method for executing a function when someone clicks on it?
I am practicing DOM events and notice that I can use addEventListener or onclick method both for triggering a function when we click on the button but I want to know is there any logical difference between them? What should we use when? I am fairly new to programming. Here is my code, Answer The main differen…