Skip to content

Instantly share code, notes, and snippets.

View jrjames83's full-sized avatar

Jeff James jrjames83

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// Bonfire: Diff Two Arrays
// Author: @fcc0208647c
// Challenge: http://www.freecodecamp.com/challenges/bonfire-diff-two-arrays
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function diff(arr1, arr2) {
arr3 = arr1.concat(arr2);
final = arr3.filter(function(val, index, arr){
console.log(arr3.indexOf(val),arr3.lastIndexOf(val),val);
// Bonfire: Sum All Numbers in a Range
// Author: @fcc0208647c
// Challenge: http://www.freecodecamp.com/challenges/bonfire-sum-all-numbers-in-a-range
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function sumAll(arr) {
arr.sort();
start = Math.min.apply(Math, arr);
end = Math.max.apply(Math, arr);
// Bonfire: Where do I belong
// Author: @fcc0208647c
// Challenge: http://www.freecodecamp.com/challenges/bonfire-where-do-i-belong#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function where(arr, num) {
myarr = arr.sort(function(a,b) {return a - b;});
console.log(myarr);
minval = Math.min.apply(Math, myarr);
maxval = Math.max.apply(Math, myarr);
// Bonfire: Seek and Destroy
// Author: @fcc0208647c
// Challenge: http://www.freecodecamp.com/challenges/bonfire-seek-and-destroy#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function destroyer(arr) {
var slicedArgs = Array.prototype.slice.call(arguments, 1);
console.log(slicedArgs + " are my args");
mylist = arguments[0];
// Bonfire: Falsy Bouncer
// Author: @fcc0208647c
// Challenge: http://www.freecodecamp.com/challenges/bonfire-falsy-bouncer#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function bouncer(arr) {
trues = arr.filter(Boolean);
return trues;
// Bonfire: Mutations
// Author: @fcc0208647c
// Challenge: http://www.freecodecamp.com/challenges/bonfire-mutations#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function mutation(arr) {
firstElement = arr[0].toLowerCase().split('');
secondElement = arr[1].toLowerCase().split('');
for (var i=0; i<secondElement.length; i++) {
// Bonfire: Slasher Flick
// Author: @fcc0208647c
// Challenge: http://www.freecodecamp.com/challenges/bonfire-slasher-flick#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function slasher(arr, howMany) {
return arr.slice(howMany, arr.length);
}