Skip to content

Category: Questions

Get dataset object from an element in Puppeteer

Say i have this element: I’d like to get the data attributes via dataset. I can use the code below to get an individual data attribute, but if i want to get both data-* attributes, i’d have to scrape twice. I’ve tried this, but returns an empty object Answer Managed to accomplish it with thi…

React JS sorting issue

I’m trying to sort some data in my application. I’d like to support the following options: Price (low to high) Price (high to low) Mileage (low to high) Mileage (high to low) It looks like price sorting is working. However, when I click on “lowest mileage”, it keeps showing the highest…

Function default object, props with default values are undefined

I am working on a function and when I set all of the required inputs as object props and some of them with default values, those that I gave default values to are undefined. Basically, I want to create some of the properties of the object required and others not. The issue is that, if I provide a value to