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
function chunkArrayInGroups(arr, size) { | |
var newarr=[]; | |
for (i=arr.length, y=0; i>0; i-=size, y+=size){ | |
newarr.push(arr.slice(y, size+y)); | |
} | |
/* Simpler using just one var but calculates arr.length on each iteration | |
for (i=0; i<arr.length; i+=size){ | |
newarr.push(arr.slice(i, i+size)); | |
}*/ |
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
function slasher(arr, howMany) { | |
return arr.slice(howMany); | |
/* With the splice() method: | |
arr.splice(0, howMany); | |
return arr; | |
*/ | |
/* Using loops: | |
var newarr = []; |
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
// Mutations | |
function mutation(arr) { | |
var a = arr[0].toLowerCase(); | |
var b = arr[1].toLowerCase(); | |
for (i=0; i<b.length; i++){ | |
if (a.indexOf(b[i]) < 0){ | |
return false; | |
} |
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
// Falsy bouncer | |
function bouncer(arr) { | |
return arr.filter(function(val) { | |
return Boolean(val) !== false; // Same as: return (val); | |
}); | |
} | |
bouncer([7, "ate", "", false, null, 9, NaN]); |
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
<head><link href="https://fonts.googleapis.com/css?family=Inconsolata:400,700" rel="stylesheet"> | |
</head> | |
<body> | |
<nav id="navbar"> | |
<header>FCC's RWD cert.</header> | |
<ul> | |
<a href="#Basic_HTML_and_HTML5" class="nav-link"><li>Basic HTML and HTML5</li></a> | |
<a href="#Basic_CSS" class="nav-link"><li>Basic CSS</li></a> | |
<a href="#Applied_visual_design" class="nav-link"><li>Applied visual design</li></a> |
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
function testEqual(val) { | |
if (val == 12) { // Change this line | |
return "Equal"; | |
} | |
return "Not Equal"; | |
} | |
// Change this value to test | |
testEqual(10); |
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
// https://stackoverflow.com/questions/2705583/how-to-simulate-a-click-with-javascript | |
function eventFire(el, etype){ | |
if (el.fireEvent) { | |
el.fireEvent('on' + etype); | |
} else { | |
var evObj = document.createEvent('Events'); | |
evObj.initEvent(etype, true, false); | |
el.dispatchEvent(evObj); | |
} | |
} |
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
window.addEventListener("load", function(){ | |
var curU = window.location.href; // get current URL | |
var newU = curU.replace('/j/', '/wc/join/'); // Set URL for running metting in the browser | |
var browMe = document.createElement('a'); | |
browMe.setAttribute('href', newU); | |
browMe.innerHTML = 'Run in browser'; | |
document.querySelector('div[role="main"]').appendChild(browMe); // Add button to Zoom's content | |
}); |
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
const arr = ["html", "css", "js"]; | |
arr.forEach(ele => { | |
console.log(ele); // html, css, js | |
}); |
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
const arr = ['html', 'css', 'js']; | |
const iter = arr.entries(); | |
for (let value of iter) { | |
console.log(value); // [ 0, 'html' ], [ 1, 'css' ], [ 2, 'js' ] | |
} | |