Consider this code from scrubVideoToTimestamp.js:
const moment = require('moment')
const scrubVideoToTimestamp = function () {
let player = document.getElementsByTagName('video')[0]
let timestamp = this.innerHTML
const timeToGoTo = moment
.duration(timestamp)
.asSeconds()
What's not at all obvious
- What's the type of
this?
- What's the value of
this?
- If
scrubVideoToTimestamp is an event-handling function (it's supposed to be), what function adds it as a listener to an element?
- Put another way, what function makes use of
scrubVideoToTimestamp()?
- What's the name of that function that attaches
scrubVideoToTimestamp() to elements?
- What module is the attachment function in?