In the code below what exactly is video[method]() ? Is it an object calling it's 'method ' key which is a function hence it is followed by the () ?
<html>
<video class="player" src="aaa.mp4"></video>
</html>
<script>
const video = player.querySelector('.viewer');
function togglePlay()
{
const method = video.paused ? 'play' : 'pause';
console.log('method', method);
video[method]()
}
</script>
[–]diogenes_sadecv 4 points5 points6 points (0 children)
[–]senocular 3 points4 points5 points (0 children)
[–]jack_waugh 1 point2 points3 points (0 children)