Last active
April 26, 2021 23:57
-
-
Save shuantsu-zz/9d0f154e83ccd4cda4f5a0f7790ea348 to your computer and use it in GitHub Desktop.
Alura quanto tempo a aula vai levar
This file contains 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
const a = []; | |
document.querySelectorAll('.task-menu-nav-item-videoDuration').forEach((x)=>{a.push(parseInt(x.innerHTML.replace('min', '')))}); | |
const speeds = [1, 1.2, 1.5, 2, 2.5, 3]; | |
const total = a.reduce((x, y) => x + y); | |
let s = ""; | |
for (let speed of speeds) { | |
const tempo = total / speed; | |
const minutos = Math.floor(tempo); | |
const segundos = (tempo % 60).toFixed(2); | |
s += `${speed}x => ${minutos}:${segundos}\n`; | |
} | |
alert(s); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment