I have string like array and object want to convert it to pure javascript object or JSON. My string example: I found a solution converting string to JSON here https://stackoverflow.com/a/42907123/4578250 the result with above solution is: I want the result like: But I’m not able to convert the string wi…
Tag: javascript
Programmatically toggle Bootstrap 5 collapse component
I’m using a boostrap 5 “collapse”, using the data attributes approach. It works as expected. I can click the button to collapse/expand the collapsible items. The docs state I can toggle the state manually, like so: However that fails, as getInstance returns null. Strangely, if I click the co…
Getting custom components to work within react-hook-form using onChange
I have a checkout cart where you have different cart items, and for each one you can change the quantity prior to purchase. Here’s how the code looks: And the PureInput: Everything works fine in terms of submitting the form. When I do, I get an array of whatever values I have entered into the input: My …
Delete record from an array of objects in javascript
I have an array of objects that I get from an api, I get the data but I want to remove the ones that have a finish status after x time. First I must show all the records, after a certain time the records with FINISH status must be deleted I am using vue. This is the response I get:
How can I make Infinite Scroll using Firebase Realtime Database – v9
I want to make a Infinite scroll to load only 2 users data at first, then when admin will click on Load More button, it should load next 2 user data. Is it possible in Realtime Database? Similarly, I can use this to display users their post to limited numbers if they have many posts in the database instead to
How do I make a checkbox that automatically refreshes the page without changing the values of inputs?
I’m trying to make a checkbox that will automatically refresh the page every few seconds or minutes when checked using JavaScript. I found some ways to make it refresh the page, but when it does that, all of the inputs including the checkbox return to their default value. I want them to keep their curre…
Access data property of child component from parent vue 3 typescript and composition api
I have setup two components parent and child: App.vue //Parent BookForm.vue //child I’ve followed this thread from vue forum for the solution but I cannot retrieve data from child component into parent component. When I console log console.log(bookRef.value) I get undefined. What is the correct way to g…
DiscordJSv14 Recording / Receiving Voice Audio
So I’m working on a Discord bot using JS and DiscordJSv14, and want the bot to use audio from a voice chat to send to another bot, some type of listen and snitch bot. So far I got the Bot’s connecting to the voice call but can’t get any of the packets to send to the other bot. Here’s s…
Sum of two random numbers with Javascript
I’m trying to create a program with Javascript that prints two random numbers and calculates their sum. It should be really easy, but for some reason I can’t get the program to work. I’ve got the program to print random numbers, but I can’t get it to add the numbers together. What am I…
is it possible to access classes inside if statement?? the output what i am getting is wrong
It’s a program to perform a counter which increases, decreases, and reset the count from 0, but the output that I am getting is only increasing with a negative sign i access classes inside if statement directly. is it possible to directly access classes without using event objects. Answer Added values i…