Skip to content

Instantly share code, notes, and snippets.

@yayMark yayMark/carsalesHelper.js
Last active Sep 17, 2019

Embed
What would you like to do?
JavaScript: carsales.com.au helper - get the year of the car and odometer reading from the DOM
// year of car
document.querySelector('.details-wrapper h1').innerText.split(' ')[0]
// odometer
Number(document.querySelector('.key-details-item-title').innerText.split(' ')[0].replace(/,/g, ''))/20000
// 20000 km average a year
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.