Last active
September 17, 2019 23:55
-
-
Save yayMark/8b70d1fd26bde620f5871483fa7c5f35 to your computer and use it in GitHub Desktop.
JavaScript: carsales.com.au helper - get the year of the car and odometer reading from the DOM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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