What I learned on this mini-project.
If you give elements a data element, in the form data-x
you can extract these through attribute selection, this is shown below.
https://gist.github.com/e1960a63ab536fdfef0bddfe197b929d
Accessing the values for this can be done via timeNodes.dataset.time
Numbers are extracted from HTML elements in this project, but they are stored as strings. Using this method you can convert them to the numeric type
. This is useful for performing mathematical operations on them.
https://gist.github.com/462eb7419b0301a1c1db7636b8de7ce9
In this case, the method has been applied through map
.