This file contains hidden or 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
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
</head> | |
<body> | |
<video></video> | |
<script> | |
window.addEventListener('DOMContentLoaded', function() { | |
'use strict'; |
This file contains hidden or 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
/* | |
* Create a shuffle array method returning the new shuffled array instead of effecting the original | |
*/ | |
Array.prototype.shuffle = function () { | |
for (var i = this.length - 1; i > 0; i--) { | |
var randomIndex = Math.floor(Math.random() * (i + 1)); | |
var tmp = this[i]; | |
this[i] = this[randomIndex]; | |
this[randomIndex] = tmp; | |
} |
This file contains hidden or 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
// Generit list of fruits. Using this method of “for”, an object would not work | |
var fruits = ['mango', 'grapes', 'lemon', 'grapefruit', 'melon']; | |
(function () { | |
"use strict"; | |
// Setup the i variable within the current function | |
var i, li, body, | |
// Set the fruit list dom element via ID since class would imply more than 1 |