Skip to content

Instantly share code, notes, and snippets.

@usmaanalii
Created August 15, 2017 07:39
Show Gist options
  • Save usmaanalii/695c73c74486eb0bc794678f4115def5 to your computer and use it in GitHub Desktop.
Save usmaanalii/695c73c74486eb0bc794678f4115def5 to your computer and use it in GitHub Desktop.

What I learned on this mini-project.

data selector

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

ParseFloat

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment