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
// Bonfire: Steamroller | |
// Author: @radumazilu | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-steamroller | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function steamroller(arr) { | |
// I'm a steamroller, baby | |
var newArr = []; | |
var check = function(x){ | |
if(Array.isArray(x) !== true){ |
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
// Bonfire: Diff Two Arrays | |
// Author: @radumazilu | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-diff-two-arrays?solution=function%20diff(arr1%2C%20arr2)%20%7B%0A%20%20var%20newArr%20%3D%20%5B%5D%3B%0A%20%20var%20t%20%3D%200%3B%0A%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20arr1.length%3B%20i%2B%2B)%7B%0A%20%20%20%20%20%20if(arr2.indexOf(arr1%5Bi%5D)%20%3D%3D%3D%20-1)%0A%20%20%20%20%20%20%20%20newArr.push(arr1%5Bi%5D)%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20for(var%20j%20%3D%200%3B%20j%20%3C%20arr2.length%3B%20j%2B%2B)%7B%0A%20%20%20%20%20%20if(arr1.indexOf(arr2%5Bj%5D)%20%3D%3D%3D%20-1)%0A%20%20%20%20%20%20%20%20newArr.push(arr2%5Bj%5D)%3B%0A%20%20%20%20%20%20%7D%0A%20%20%2F%2F%20Same%2C%20same%3B%20but%20different.%0A%20%20return%20newArr%3B%0A%7D%0A%0Adiff(%5B1%2C%202%2C%203%2C%205%5D%2C%20%5B1%2C%202%2C%203%2C%204%2C%205%5D)%3B%0A | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function diff(arr1, arr2) { | |
var newArr = []; | |
var t = 0; | |
for(var i = 0; i < arr1.length; i++){ | |