{{ message }}

Instantly share code, notes, and snippets.

Niraj knirajkrz

Created Dec 8, 2015 — forked from anonymous/bonfire-symmetric-difference.js
http://www.freecodecamp.com/nirajkrz 's solution for Bonfire: Symmetric Difference
View bonfire-symmetric-difference.js
 // Bonfire: Symmetric Difference // Author: @nirajkrz // Challenge: http://www.freecodecamp.com/challenges/bonfire-symmetric-difference // Learn to Code at Free Code Camp (www.freecodecamp.com) function sym() { // Convert the argument object into a proper array var args = Array.prototype.slice.call(arguments);
Created Dec 8, 2015 — forked from anonymous/bonfire-validate-us-telephone-numbers.js
http://www.freecodecamp.com/nirajkrz 's solution for Bonfire: Validate US Telephone Numbers
View bonfire-validate-us-telephone-numbers.js
 // Bonfire: Validate US Telephone Numbers // Author: @nirajkrz // Challenge: http://www.freecodecamp.com/challenges/bonfire-validate-us-telephone-numbers // Learn to Code at Free Code Camp (www.freecodecamp.com) function telephoneCheck(str) { // Good luck! var re = /^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})\$/; return re.test(str);
Created Dec 3, 2015 — forked from anonymous/bonfire-arguments-optional.js
http://www.freecodecamp.com/nirajkrz 's solution for Bonfire: Arguments Optional
View bonfire-arguments-optional.js
 // Bonfire: Arguments Optional // Author: @nirajkrz // Challenge: http://www.freecodecamp.com/challenges/bonfire-arguments-optional // Learn to Code at Free Code Camp (www.freecodecamp.com) function add() { // Function to check if a number is actually a number // and return undefined otherwise.
Created Dec 3, 2015 — forked from anonymous/bonfire-binary-agents.js
http://www.freecodecamp.com/nirajkrz 's solution for Bonfire: Binary Agents
View bonfire-binary-agents.js
 // Bonfire: Binary Agents // Author: @nirajkrz // Challenge: http://www.freecodecamp.com/challenges/bonfire-binary-agents // Learn to Code at Free Code Camp (www.freecodecamp.com) //Return an English translated sentence of the passed binary string. function binaryAgent(str) {
Created Dec 3, 2015 — forked from anonymous/bonfire-steamroller.js
http://www.freecodecamp.com/nirajkrz 's solution for Bonfire: Steamroller
View bonfire-steamroller.js
 // Bonfire: Steamroller // Author: @nirajkrz // Challenge: http://www.freecodecamp.com/challenges/bonfire-steamroller // Learn to Code at Free Code Camp (www.freecodecamp.com) //Flatten a nested array. You must account for varying levels of nesting. function steamroller(arr) { // I'm a steamroller, baby var flattenedArray = [];
Created Dec 3, 2015 — forked from anonymous/bonfire-drop-it.js
http://www.freecodecamp.com/nirajkrz 's solution for Bonfire: Drop it
View bonfire-drop-it.js
 // Bonfire: Drop it // Author: @nirajkrz // Challenge: http://www.freecodecamp.com/challenges/bonfire-drop-it // Learn to Code at Free Code Camp (www.freecodecamp.com) //Drop the elements of an array (first argument), starting from the front, until the predicate (second argument) returns true. function drop(arr, func) { // Drop them elements. var lol = arr.length;
Created Dec 3, 2015 — forked from anonymous/bonfire-finders-keepers.js
http://www.freecodecamp.com/nirajkrz 's solution for Bonfire: Finders Keepers
View bonfire-finders-keepers.js
 // Bonfire: Finders Keepers // Author: @nirajkrz // Challenge: http://www.freecodecamp.com/challenges/bonfire-finders-keepers // Learn to Code at Free Code Camp (www.freecodecamp.com) //Create a function that looks through an array (first argument) and returns the first element in the array that passes a truth test (second argument). function find(arr, func) { var num;
Created Dec 3, 2015 — forked from anonymous/bonfire-smallest-common-multiple.js
http://www.freecodecamp.com/nirajkrz 's solution for Bonfire: Smallest Common Multiple
View bonfire-smallest-common-multiple.js
 // Bonfire: Smallest Common Multiple // Author: @nirajkrz // Challenge: http://www.freecodecamp.com/challenges/bonfire-smallest-common-multiple // Learn to Code at Free Code Camp (www.freecodecamp.com) function smallestCommons(arr) { arr.sort(function(a, b) { return b - a; });
Created Dec 3, 2015 — forked from anonymous/bonfire-sum-all-primes.js
http://www.freecodecamp.com/nirajkrz 's solution for Bonfire: Sum All Primes
View bonfire-sum-all-primes.js
 // Bonfire: Sum All Primes // Author: @nirajkrz // Challenge: http://www.freecodecamp.com/challenges/bonfire-sum-all-primes // Learn to Code at Free Code Camp (www.freecodecamp.com) //Sum all the prime numbers up to and including the provided number. function sumPrimes(num) { var res = 0; // FUnction to get the primes up to max in an array
Created Dec 3, 2015 — forked from anonymous/bonfire-sum-all-odd-fibonacci-numbers.js
http://www.freecodecamp.com/nirajkrz 's solution for Bonfire: Sum All Odd Fibonacci Numbers
View bonfire-sum-all-odd-fibonacci-numbers.js
 // Bonfire: Sum All Odd Fibonacci Numbers // Author: @nirajkrz // Challenge: http://www.freecodecamp.com/challenges/bonfire-sum-all-odd-fibonacci-numbers // Learn to Code at Free Code Camp (www.freecodecamp.com) //Return the sum of all odd Fibonacci numbers up to and including the passed number if it is a Fibonacci number. function sumFibs(num) { var prevNumber = 0; var currNumber = 1; var result = 0;
You can’t perform that action at this time.