├── FCC ├── Day28 │ ├── oleg.js │ └── lukyanovfedor.js ├── Day11 │ ├── romanovsci.js │ ├── p9gehka.js │ ├── oleg.js │ └── lukyanovfedor.js ├── Day01 │ ├── oleg.js │ ├── romanovsci.js │ ├── lukyanovfedor.js │ └── p9gehka.js ├── Day07 │ ├── romanovsci.js │ ├── oleg.js │ └── lukyanovfedor.js ├── Day02 │ ├── p9gehka.js │ ├── oleg.js │ ├── romanovsci.js │ └── lukyanovfedor.js ├── Day03 │ ├── romanovsci.js │ ├── p9gehka.js │ ├── lukyanovfedor.js │ └── oleg.js ├── Day09 │ ├── p9gehka.js │ ├── oleg.js │ ├── romanovsci.js │ └── lukyanovfedor.js ├── Day24 │ ├── romanovsci.js │ ├── lukyanovfedor.js │ └── oleg.js ├── Day08 │ ├── p9gehka.js │ ├── oleg.js │ ├── lukyanovfedor.js │ └── romanovsci.js ├── Day27 │ ├── lukyanovfedor.js │ └── oleg.js ├── Day06 │ ├── oleg.js │ ├── romanovsci.js │ └── lukyanovfedor.js ├── Day31 │ ├── lukyanovfedor.js │ └── oleg.js ├── Day22 │ ├── oleg.js │ └── nikitin2009.js ├── Day13 │ ├── lukyanovfedor.js │ ├── oleg.js │ ├── romanovsci.js │ └── p9gehka.js ├── Day19 │ ├── oleg.js │ └── lukyanovfedor.js ├── Day26 │ ├── oleg.js │ └── lukyanovfedor.js ├── Day12 │ ├── romanovsci.js │ ├── p9gehka.js │ ├── lukyanovfedor.js │ └── oleg.js ├── Day05 │ ├── oleg.js │ ├── lukyanovfedor.js │ └── romanovsci.js ├── Day10 │ ├── oleg.js │ ├── romanovsci.js │ ├── lukyanovfedor.js │ └── p9gehka.js ├── Day17 │ ├── oleg.js │ ├── romanovsci.js │ └── lukyanovfedor.js ├── Day16 │ ├── romanovsci.js │ ├── lukyanovfedor.js │ └── oleg.js ├── Day04 │ ├── oleg.js │ ├── lukyanovfedor.js │ └── romanovsci.js ├── Day33 │ ├── lukyanovfedor.js │ └── oleg.js ├── Day15 │ ├── lukyanovfedor.js │ ├── oleg.js │ └── romanovsci.js ├── Day32 │ ├── lukyanovfedor.js │ └── oleg.js ├── Day14 │ ├── romanovsci.js │ ├── lukyanovfedor.js │ └── oleg.js ├── Day18 │ ├── romanovsci.js │ ├── oleg.js │ ├── lukyanovfedor.js │ └── ramkam.js ├── Day23 │ ├── lukyanovfedor.js │ ├── romanovsci.js │ └── oleg.js ├── Day29 │ ├── oleg.js │ └── lukyanovfedor.js ├── Day36 │ ├── oleg.js │ ├── lukyanovfedor.js │ └── tsur.js ├── Day34 │ ├── oleg.js │ └── lukyanovfedor.js ├── Day35 │ ├── lukyanovfedor.js │ └── oleg.js ├── Day30 │ ├── oleg.js │ └── lukyanovfedor.js ├── Day25 │ ├── oleg.js │ └── lukyanovfedor.js ├── Day20 │ ├── lukyanovfedor.js │ ├── romanovsci.js │ └── oleg.js ├── Day21 │ ├── romanovsci.js │ ├── lukyanovfedor.js │ └── oleg.js └── README.md ├── Projects ├── Project-1 │ ├── P9gehka │ │ ├── README.md │ │ ├── index.html │ │ └── quiz.js │ └── README.md └── Project-2 │ └── README.md ├── Study Guide ├── Week1 │ └── Add file to this folder.txt └── Study Guide.md ├── Git guide.md └── README.md /FCC/Day28/oleg.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Projects/Project-1/P9gehka/README.md: -------------------------------------------------------------------------------- 1 | http://codepen.io/p9gehka/pen/ZGxmaX -------------------------------------------------------------------------------- /FCC/Day11/romanovsci.js: -------------------------------------------------------------------------------- 1 | function slasher(arr, howMany) { 2 | return arr.slice(howMany); 3 | } 4 | -------------------------------------------------------------------------------- /FCC/Day01/oleg.js: -------------------------------------------------------------------------------- 1 | function reverseString(str) { 2 | return str.split('').reverse().join(''); 3 | } 4 | -------------------------------------------------------------------------------- /FCC/Day07/romanovsci.js: -------------------------------------------------------------------------------- 1 | function end(str, target) { 2 | return str.charAt(str.length - 1) == target; 3 | } -------------------------------------------------------------------------------- /FCC/Day01/romanovsci.js: -------------------------------------------------------------------------------- 1 | function reverseString(str) { 2 | return str.split('').reverse().join(''); 3 | } 4 | -------------------------------------------------------------------------------- /FCC/Day02/p9gehka.js: -------------------------------------------------------------------------------- 1 | function factorialize(num) { 2 | return (!~-num && 1) || num * factorialize(num - 1); 3 | } -------------------------------------------------------------------------------- /FCC/Day03/romanovsci.js: -------------------------------------------------------------------------------- 1 | function palindrome(str) { 2 | return str == str.split('').reverse().join(''); 3 | } -------------------------------------------------------------------------------- /FCC/Day09/p9gehka.js: -------------------------------------------------------------------------------- 1 | function truncate (str, num) { 2 | return str.slice(0, num) + (str.slice(num) && "..."); 3 | } -------------------------------------------------------------------------------- /FCC/Day24/romanovsci.js: -------------------------------------------------------------------------------- 1 | function boo(bool) { 2 | return typeof bool === "boolean" ? true : false; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /FCC/Day07/oleg.js: -------------------------------------------------------------------------------- 1 | function end(str, target) { 2 | return (str.slice(-target.length) === target) ? true : false; 3 | } -------------------------------------------------------------------------------- /FCC/Day08/p9gehka.js: -------------------------------------------------------------------------------- 1 | function repeat(str, num) { 2 | return (Math.max(num, 0) || "") && new Array(num + 1).join(str); 3 | } -------------------------------------------------------------------------------- /FCC/Day09/oleg.js: -------------------------------------------------------------------------------- 1 | function truncate(str, num) { 2 | return (str.length > num) ? str.slice(0, num - 3) + "..." : str; 3 | } 4 | -------------------------------------------------------------------------------- /FCC/Day09/romanovsci.js: -------------------------------------------------------------------------------- 1 | function truncate(str, num) { 2 | if(str.length > num) 3 | return str.slice(0, num) + "..."; 4 | } 5 | -------------------------------------------------------------------------------- /Projects/Project-2/README.md: -------------------------------------------------------------------------------- 1 | # #Project-2 has it's own repo now :) 2 | 3 | __[Click here](https://github.com/welearnjs/helpersApp)__ 4 | -------------------------------------------------------------------------------- /FCC/Day11/p9gehka.js: -------------------------------------------------------------------------------- 1 | function slasher(arr, howMany) { 2 | if(!howMany) {return arr}; 3 | arr.shift(); 4 | return slasher(arr, howMany - 1); 5 | } -------------------------------------------------------------------------------- /FCC/Day03/p9gehka.js: -------------------------------------------------------------------------------- 1 | function palindrome(str) { 2 | str = str.toLowerCase().match(/\w/ig); 3 | return (str.join('') === str.reverse().join('')); 4 | } -------------------------------------------------------------------------------- /FCC/Day07/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function end(str, target) { 2 | return str.slice(-target.length) === target; 3 | } 4 | 5 | console.log(end('Bastian', 'n')); -------------------------------------------------------------------------------- /FCC/Day11/oleg.js: -------------------------------------------------------------------------------- 1 | function slasher(arr, howMany) { 2 | arr.splice(0, howMany); 3 | return arr; 4 | } 5 | 6 | console.log(slasher([1, 2, 3], 2)); 7 | -------------------------------------------------------------------------------- /FCC/Day01/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function reverseString(str) { 2 | return str.split("").reverse().join(""); 3 | } 4 | 5 | console.log(reverseString("hello")); 6 | -------------------------------------------------------------------------------- /FCC/Day03/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function palindrome(str) { 2 | return str === str.split("").reverse().join(""); 3 | } 4 | 5 | console.log(palindrome("eye")); 6 | -------------------------------------------------------------------------------- /FCC/Day11/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function slasher(arr, howMany) { 2 | arr.splice(0, howMany); 3 | 4 | return arr; 5 | } 6 | 7 | console.log(slasher([1, 2, 3], 2)); -------------------------------------------------------------------------------- /FCC/Day24/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function boo(bool) { 2 | return Object.prototype.toString.call(bool) === '[object Boolean]'; 3 | } 4 | 5 | console.log(boo(null)); -------------------------------------------------------------------------------- /FCC/Day24/oleg.js: -------------------------------------------------------------------------------- 1 | function boo(bool) { 2 | return (Object.prototype.toString.call(bool) === '[object Boolean]') ? true : false; 3 | 4 | } 5 | 6 | d(boo(null)); -------------------------------------------------------------------------------- /FCC/Day27/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function spinalCase(str) { 2 | return str.toLowerCase().split(' ').join('-'); 3 | } 4 | 5 | console.log(spinalCase('This Is Spinal Tap')); -------------------------------------------------------------------------------- /FCC/Day02/oleg.js: -------------------------------------------------------------------------------- 1 | function factorialize(num) { 2 | if (num === 1) { 3 | return 1; 4 | } else { 5 | return num * factorialize(num - 1); 6 | } 7 | } -------------------------------------------------------------------------------- /FCC/Day02/romanovsci.js: -------------------------------------------------------------------------------- 1 | function factorialize(num) { 2 | var fact = 1; 3 | 4 | for(var i =1; i <= num; i++){ 5 | fact *= i; 6 | } 7 | 8 | return fact; 9 | } -------------------------------------------------------------------------------- /FCC/Day06/oleg.js: -------------------------------------------------------------------------------- 1 | function largestOfFour(arr) { 2 | return arr.map(function (item, index, array) { 3 | return Math.max.apply(null, item); 4 | }); 5 | } 6 | -------------------------------------------------------------------------------- /FCC/Day31/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function find(arr, func) { 2 | return arr.filter(func)[0]; 3 | } 4 | 5 | console.log(find([1, 2, 3, 4], function(num){ return num % 2 === 0; })); -------------------------------------------------------------------------------- /FCC/Day08/oleg.js: -------------------------------------------------------------------------------- 1 | function repeat(str, num) { 2 | var rep = ""; 3 | for (var i = 0; i < num; i++) { 4 | rep = rep + str; 5 | } 6 | return rep; 7 | } 8 | -------------------------------------------------------------------------------- /FCC/Day22/oleg.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created with Test. 3 | * User: Apaksimen 4 | * Date: 2015-06-12 5 | * Time: 11:25 AM 6 | * To change this template use Tools | Templates. 7 | */ 8 | -------------------------------------------------------------------------------- /FCC/Day13/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function bouncer(arr) { 2 | return arr.filter(function(item) { 3 | return !!item; 4 | }); 5 | } 6 | console.log(bouncer([7, 'ate', '', false, 9])); -------------------------------------------------------------------------------- /FCC/Day19/oleg.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created with Test. 3 | * User: Apaksimen 4 | * Date: 2015-06-12 5 | * Time: 11:25 AM 6 | * To change this template use Tools | Templates. 7 | */ 8 | -------------------------------------------------------------------------------- /Study Guide/Week1/Add file to this folder.txt: -------------------------------------------------------------------------------- 1 | Following our Git guide, please add a ‘yournickname.js’ file to this folder 2 | >>> Study Guide / Week1 / yournickname.js 3 | 4 | 5 | -------------------------------------------------------------------------------- /FCC/Day26/oleg.js: -------------------------------------------------------------------------------- 1 | function convert(str) { 2 | return str.replace(/&/g, '&').replace(/<+/g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '''); 3 | 4 | } -------------------------------------------------------------------------------- /FCC/Day12/romanovsci.js: -------------------------------------------------------------------------------- 1 | function mutation(arr) { 2 | for(var i = 0; i < arr[1].length; i++){ 3 | if( !(arr[0].includes(arr[1].charAt(i))) ) 4 | return false; 5 | } 6 | 7 | return true; 8 | } -------------------------------------------------------------------------------- /FCC/Day05/oleg.js: -------------------------------------------------------------------------------- 1 | function titleCase(str) { 2 | 3 | return str.toLowerCase().split(' ').map(function (item) { 4 | return item[0].toUpperCase() + item.slice(1); 5 | }).join(' '); 6 | 7 | } -------------------------------------------------------------------------------- /FCC/Day10/oleg.js: -------------------------------------------------------------------------------- 1 | function chunk(arr, size) { 2 | var result = []; 3 | for (i = 0; i < arr.length; i += size) { 4 | result.push(arr.slice(i, i + size)); 5 | } 6 | return result; 7 | } -------------------------------------------------------------------------------- /FCC/Day09/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function truncate(str, num) { 2 | return str.length >= num ? str.slice(0, num) + "..." : str; 3 | } 4 | 5 | console.log(truncate('A-tisket a-tasket A green and yellow basket', 11)); -------------------------------------------------------------------------------- /FCC/Day10/romanovsci.js: -------------------------------------------------------------------------------- 1 | function chunk(arr, size) { 2 | var result = []; 3 | 4 | for (i = 0; i < arr.length; i += size) { 5 | result.push(arr.slice(i, i + size)); 6 | } 7 | 8 | return result; 9 | } -------------------------------------------------------------------------------- /FCC/Day17/oleg.js: -------------------------------------------------------------------------------- 1 | function sumAll(arr) { 2 | sum = 0; 3 | for (i = Math.min(arr[0], arr[1]); i <= Math.max(arr[0], arr[1]); i++) 4 | sum += i; 5 | return sum; 6 | } 7 | 8 | sumAll([1, 4]); 9 | -------------------------------------------------------------------------------- /FCC/Day01/p9gehka.js: -------------------------------------------------------------------------------- 1 | function reverseString(str) { 2 | return (!(str.length - 1) && str) || str[str.length - 1] + reverseString(str.slice(0, str.length - 1)); 3 | } 4 | console.log(reverseString('helloasdfasdf')); -------------------------------------------------------------------------------- /FCC/Day17/romanovsci.js: -------------------------------------------------------------------------------- 1 | function sumAll(arr) { 2 | var sum = 0; 3 | if(arr[0] > arr[1]) arr.reverse(); 4 | 5 | for(var i = arr[0]; i <= arr[1]; i++){ 6 | sum += i; 7 | } 8 | 9 | return sum; 10 | } -------------------------------------------------------------------------------- /FCC/Day02/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function factorialize(num) { 2 | if (num - 1 > 0) { 3 | return num * factorialize(num-1); 4 | } 5 | 6 | return num === 0 ? 1 : num; 7 | } 8 | 9 | console.log(factorialize(5)); 10 | -------------------------------------------------------------------------------- /FCC/Day08/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function repeat(str, num) { 2 | var out = ""; 3 | 4 | while (num !== 0) { 5 | out += str; 6 | 7 | --num; 8 | } 9 | 10 | return out; 11 | } 12 | 13 | console.log(repeat('abc', 3)); -------------------------------------------------------------------------------- /FCC/Day16/romanovsci.js: -------------------------------------------------------------------------------- 1 | function where(arr, num) { 2 | arr.sort(function(a,b){ 3 | return a-b; 4 | }); 5 | 6 | for(var i in arr){ 7 | if(arr[i] > num) 8 | return i 9 | } 10 | 11 | return -1; 12 | } -------------------------------------------------------------------------------- /FCC/Day05/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function titleCase(str) { 2 | return str.split(" ").map(function(w) { 3 | return w[0].toUpperCase() + w.slice(1); 4 | }).join(" "); 5 | } 6 | 7 | console.log(titleCase("I'm a little tea pot")); 8 | -------------------------------------------------------------------------------- /FCC/Day08/romanovsci.js: -------------------------------------------------------------------------------- 1 | function repeat(str, num) { 2 | if(num < 0) return ""; 3 | 4 | var repeat = ""; 5 | 6 | for(var i = 0; i < num; i++){ 7 | repeat = repeat + str; 8 | } 9 | 10 | return repeat; 11 | } -------------------------------------------------------------------------------- /FCC/Day04/oleg.js: -------------------------------------------------------------------------------- 1 | function findLongestWord(str) { 2 | var n = str.split(' '), 3 | a = []; 4 | for (var i = 0; i < n.length; i++) { 5 | a.push(n[i].length); 6 | } 7 | return Math.max.apply(null, a); 8 | } -------------------------------------------------------------------------------- /FCC/Day13/oleg.js: -------------------------------------------------------------------------------- 1 | function bouncer(arr) { 2 | return arr.filter(function (item) { 3 | return (!item) ? item : item; 4 | }); 5 | } 6 | console.log(bouncer([null, 0])); 7 | console.log(bouncer([7, 'ate', "", false, 9])); 8 | -------------------------------------------------------------------------------- /FCC/Day13/romanovsci.js: -------------------------------------------------------------------------------- 1 | function bouncer(arr) { 2 | var resultArray = []; 3 | 4 | for(var i = 0; i < arr.length; i++){ 5 | if(Boolean(arr[i])){ 6 | resultArray.push(arr[i]); 7 | } 8 | } 9 | 10 | return resultArray; 11 | } -------------------------------------------------------------------------------- /FCC/Day13/p9gehka.js: -------------------------------------------------------------------------------- 1 | function where(collection, source) { 2 | return collection.filter(function (item) { 3 | var key; 4 | 5 | for (key in source) { 6 | if (source[key] !== item[key]) {return; } 7 | } 8 | return item; 9 | }); 10 | } -------------------------------------------------------------------------------- /FCC/Day33/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function steamroller(arr) { 2 | return arr.reduce(function(prev, current) { 3 | return prev.concat(Array.isArray(current) ? steamroller(current) : current); 4 | }, []); 5 | } 6 | 7 | console.log(steamroller([1, [2], [3, [[4]]]])); -------------------------------------------------------------------------------- /FCC/Day12/p9gehka.js: -------------------------------------------------------------------------------- 1 | function mutation(arr) { 2 | var reg; 3 | 4 | return arr[1].split('').every(function (item) { 5 | reg = new RegExp(item, "ig"); 6 | return arr[0].match(reg) && !!(arr[1].match(reg).length === arr[0].match(reg).length); 7 | }); 8 | 9 | } -------------------------------------------------------------------------------- /FCC/Day15/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function destroyer(arr) { 2 | var args = Array.prototype.splice.call(arguments, 1); 3 | 4 | return arr.filter(function(item) { 5 | return args.indexOf(item) < 0; 6 | }); 7 | } 8 | 9 | console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3)); -------------------------------------------------------------------------------- /FCC/Day16/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function where(arr, num) { 2 | var index; 3 | 4 | arr.forEach(function(elem, indx) { 5 | if (elem <= num) { 6 | index = indx; 7 | } 8 | }); 9 | 10 | return index + 1; 11 | } 12 | 13 | console.log(where([40, 60], 70)); 14 | -------------------------------------------------------------------------------- /FCC/Day04/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function findLongestWord(str) { 2 | return str.split(" ").reduce(function(last, current) { 3 | return current.length >= last.length ? current : last; 4 | }).length; 5 | } 6 | 7 | console.log(findLongestWord("The quick brown fox jumped over the lazy dog")); 8 | -------------------------------------------------------------------------------- /FCC/Day32/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function drop(arr, func) { 2 | for (var i = 0; i < arr.length; i++) { 3 | if (func(arr[0])) { 4 | break; 5 | } 6 | 7 | arr.splice(0, 1); 8 | } 9 | 10 | return arr; 11 | } 12 | 13 | console.log(drop([1, 2, 3], function(n) {return n > 2; })); -------------------------------------------------------------------------------- /FCC/Day06/romanovsci.js: -------------------------------------------------------------------------------- 1 | function largestOfFour(arr) { 2 | var largestNumber = 0; 3 | 4 | for(var i = 0; i < arr.length; i++){ 5 | for(var j = 0; j < arr[i].length; j++){ 6 | if(arr[i][j] > largestNumber) largestNumber = arr[i][j]; 7 | } 8 | } 9 | 10 | return largestNumber; 11 | } -------------------------------------------------------------------------------- /FCC/Day17/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function sumAll(arr) { 2 | var min = Math.min.apply(null, arr), 3 | max = Math.max.apply(null, arr), 4 | sum = 0, 5 | i; 6 | 7 | for (i = min; i <= max; i++) { 8 | sum += i; 9 | } 10 | 11 | return sum; 12 | } 13 | 14 | console.log(sumAll([1, 4])); -------------------------------------------------------------------------------- /FCC/Day05/romanovsci.js: -------------------------------------------------------------------------------- 1 | function titleCase(str) { 2 | var wordArray = str.split(" "); 3 | 4 | for(var i = 0; i < wordArray.length; i++){ 5 | var tmp = wordArray[i].charAt(0).toUpperCase() + wordArray[i].slice(1); 6 | wordArray[i] = tmp; 7 | } 8 | 9 | return wordArray.join(" "); 10 | } -------------------------------------------------------------------------------- /FCC/Day14/romanovsci.js: -------------------------------------------------------------------------------- 1 | function where(collection, source) { 2 | var arr = []; 3 | 4 | for(var i = 0; i < collection.length; i++){ 5 | var last = collection[i].last; 6 | var sourceLast = source.last; 7 | if(sourceLast === last){ 8 | arr.push(collection[i]); 9 | } 10 | } 11 | 12 | return arr; 13 | } -------------------------------------------------------------------------------- /FCC/Day26/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | // this solution does not work in node 2 | function convert(str) { 3 | var div = document.createElement('div'), 4 | text = document.createTextNode(str); 5 | 6 | div.appendChild(text); 7 | 8 | return div.innerHTML; 9 | } 10 | 11 | console.log(convert('Dolce & Gabbana')); -------------------------------------------------------------------------------- /FCC/Day06/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function largestOfFour(arr) { 2 | return arr.map(function(a) { 3 | return a.reduce(function(last, current) { 4 | return current >= last ? current : last; 5 | }); 6 | }); 7 | } 8 | 9 | console.log(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])); -------------------------------------------------------------------------------- /FCC/Day15/oleg.js: -------------------------------------------------------------------------------- 1 | function destroyer(arr) { 2 | var b = []; 3 | var a1 = arguments[1]; 4 | var a2 = arguments[2]; 5 | arr.filter(function (i) { 6 | return !(i === a1 | i === a2) ? b.push(i) : null; 7 | }); 8 | return b; 9 | } 10 | 11 | console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3)); -------------------------------------------------------------------------------- /FCC/Day32/oleg.js: -------------------------------------------------------------------------------- 1 | function drop(arr, func) { 2 | var arr2 = []; 3 | for (var i = 0; i < arr.length; i++) { 4 | if (func(arr[i])) { 5 | arr2.push(arr[i]); 6 | } 7 | } 8 | return arr2; 9 | 10 | } 11 | 12 | console.log(drop([1, 2, 3], function (n) { 13 | return n < 3; 14 | })); -------------------------------------------------------------------------------- /FCC/Day10/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function chunk(arr, size) { 2 | var out = [], 3 | start = 0, 4 | parts = Math.round(arr.length / size); 5 | 6 | while (start < parts) { 7 | out.push(arr.splice(0, size)); 8 | 9 | ++start; 10 | } 11 | 12 | return out; 13 | } 14 | 15 | console.log(chunk(['a', 'b', 'c', 'd'], 2)); -------------------------------------------------------------------------------- /FCC/Day12/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function mutation(arr) { 2 | var out; 3 | 4 | for (var i = 0; i < arr[1].length; i++) { 5 | if (arr[0].indexOf(arr[1][i]) < 0) { 6 | out = false; 7 | 8 | break; 9 | } 10 | 11 | out = true; 12 | } 13 | 14 | return out; 15 | } 16 | 17 | console.log(mutation(['hello', 'hey'])); -------------------------------------------------------------------------------- /FCC/Day04/romanovsci.js: -------------------------------------------------------------------------------- 1 | function findLongestWord(str) { 2 | var wordArray = str.split(" "); 3 | var indexOfLongestWord = 0; 4 | 5 | for(var i = 0; i < wordArray.length; i++){ 6 | if(wordArray[i].length > wordArray[indexOfLongestWord].length) indexOfLongestWord = i; 7 | } 8 | 9 | return wordArray[indexOfLongestWord]; 10 | } -------------------------------------------------------------------------------- /FCC/Day16/oleg.js: -------------------------------------------------------------------------------- 1 | function where(arr, num) { 2 | // filter only highest 3 | var a = arr.filter(function (i) { 4 | return i >= num; 5 | }); 6 | return arr.indexOf(a[0]); 7 | } 8 | 9 | console.log(where([40, 60], 50)); 10 | console.log(where([10, 20, 40, 50], 30)); 11 | console.log(where([10, 20, 30, 40, 50], 30)); -------------------------------------------------------------------------------- /FCC/Day18/romanovsci.js: -------------------------------------------------------------------------------- 1 | function diff(arr1, arr2) { 2 | var newArray = []; 3 | 4 | arr1.forEach(function(arg){ 5 | if (arr2.indexOf(arg) == -1) newArray.push(arg); 6 | }); 7 | 8 | arr2.forEach(function(arg){ 9 | if (arr1.indexOf(arg) == -1) newArray.push(arg); 10 | }); 11 | 12 | return newArray; 13 | } -------------------------------------------------------------------------------- /FCC/Day23/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function fearNotLetter(str) { 2 | var first = str[0], 3 | last = str[str.length - 1], 4 | out = '', 5 | i; 6 | 7 | for (i = first.charCodeAt(0); i <= last.charCodeAt(0); i++) { 8 | out += String.fromCharCode(i); 9 | } 10 | 11 | return out === str ? undefined : out; 12 | } 13 | 14 | console.log(fearNotLetter('abce')); -------------------------------------------------------------------------------- /FCC/Day29/oleg.js: -------------------------------------------------------------------------------- 1 | function sumPrimes(num) { 2 | var count = 0, 3 | sum = 0; 4 | for (var i = 1; i <= num; i++) { 5 | for (var j = i; j !== 0; j--) { 6 | if (i % j === 0) count++; 7 | } 8 | if (count === 2) sum += i; 9 | count = 0; 10 | } 11 | return sum; 12 | } 13 | 14 | console.log(sumPrimes(10)); -------------------------------------------------------------------------------- /FCC/Day36/oleg.js: -------------------------------------------------------------------------------- 1 | function add(x, y) { 2 | if (!x || typeof y !== 'number' && y !== undefined) { 3 | return; 4 | } else if (arguments.length === 1 && !isNaN(x)) { 5 | return function addMore(y) { 6 | if (typeof y === 'number') return x + y; 7 | }; 8 | } 9 | if (arguments.length === 2) return x + y; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FCC/Day18/oleg.js: -------------------------------------------------------------------------------- 1 | function diff(arr1, arr2) { 2 | var newArr = []; 3 | arr1.forEach(function (e) { 4 | if (arr2.indexOf(e) === -1) newArr.push(e); 5 | }); 6 | arr2.forEach(function (e) { 7 | if (arr1.indexOf(e) === -1) newArr.push(e); 8 | }); 9 | return newArr; 10 | } 11 | 12 | 13 | console.log(diff([1, 2, 3, 5], [1, 2, 3, 4, 5])); -------------------------------------------------------------------------------- /FCC/Day18/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function diff(arr1, arr2) { 2 | var out = []; 3 | 4 | arr1.concat(arr2).forEach(function(item) { 5 | var outIndx = out.indexOf(item); 6 | 7 | if (outIndx >= 0) { 8 | out.splice(outIndx, 1); 9 | } else { 10 | out.push(item); 11 | } 12 | }); 13 | 14 | return out; 15 | } 16 | 17 | console.log(diff([1, 2, 3, 5], [1, 2, 3, 4, 5])); -------------------------------------------------------------------------------- /FCC/Day33/oleg.js: -------------------------------------------------------------------------------- 1 | function steamroller(arr) { 2 | 3 | return arr.toString().replace(/,+/, ',').split(',').map(function (item, index, array) { 4 | return (!isNaN(item)) ? parseInt(item) : item; 5 | }); 6 | 7 | } 8 | 9 | 10 | console.log(steamroller([1, [2], [3, [[4]]]])); 11 | console.log(steamroller([1, [], [3, [[4]]]])); 12 | console.log(steamroller([[['a']], [['b']]])); -------------------------------------------------------------------------------- /FCC/Day34/oleg.js: -------------------------------------------------------------------------------- 1 | function binaryAgent(str) { 2 | return str.split(' ').map(function (item) { 3 | return String.fromCharCode(parseInt((item), 2)); 4 | }).join(''); 5 | } 6 | 7 | console.log(binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111')); -------------------------------------------------------------------------------- /FCC/Day34/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function binaryAgent(str) { 2 | return str.split(' ').map(function(binary) { 3 | return String.fromCharCode(parseInt(binary, 2)); 4 | }).join(''); 5 | } 6 | 7 | console.log(binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111')); 8 | -------------------------------------------------------------------------------- /FCC/Day10/p9gehka.js: -------------------------------------------------------------------------------- 1 | function chunk(arr, size) { 2 | var result, smallArr; 3 | result = []; 4 | smallArr = []; 5 | arr.forEach(function (item, i) { 6 | smallArr.push(item); 7 | if (i === arr.length - 1) { 8 | result.push(smallArr); 9 | return; 10 | } 11 | if (!((i + 1) % size)) { 12 | result.push(smallArr); 13 | smallArr = []; 14 | } 15 | }); 16 | return result; 17 | } -------------------------------------------------------------------------------- /FCC/Day35/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function every(collection, pre) { 2 | for (var i = 0; i < collection.length; i++) { 3 | if (!collection[i].hasOwnProperty(pre)) { 4 | return false; 5 | } 6 | } 7 | 8 | return true; 9 | } 10 | 11 | console.log(every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex')); -------------------------------------------------------------------------------- /FCC/Day29/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function sumPrimes(num) { 2 | var count = num - 1; 3 | 4 | var isPrime = function(n) { 5 | for(var i = 2; i < n; i++) { 6 | if (n % i === 0) { 7 | return false; 8 | } 9 | } 10 | 11 | return n > 1; 12 | }; 13 | 14 | var sum = 0; 15 | 16 | while (count >= 0) { 17 | if (isPrime(count)) { 18 | sum += count; 19 | } 20 | 21 | count--; 22 | } 23 | 24 | return sum + num; 25 | } 26 | 27 | console.log(sumPrimes(10)); -------------------------------------------------------------------------------- /FCC/Day35/oleg.js: -------------------------------------------------------------------------------- 1 | function every(collection, pre) { 2 | return collection.every(function (i) { 3 | return (i.hasOwnProperty(pre)) ? i : false; 4 | }); 5 | } 6 | 7 | 8 | //d(every([{ 9 | // 'user': 'Tinky-Winky', 10 | // 'sex': 'male' 11 | //}, { 12 | // 'user': 'Dipsy', 13 | // 'sex': 'male' 14 | //}, { 15 | // 'user': 'Laa-Laa', 16 | // 'sex': 'female' 17 | //}, { 18 | // 'user': 'Po', 19 | // 'sex': 'female' 20 | //}], 'sex')); 21 | -------------------------------------------------------------------------------- /FCC/Day30/oleg.js: -------------------------------------------------------------------------------- 1 | function smallestCommons(arr) { 2 | var min = Math.min(arr[0], arr[1]); 3 | var max = Math.max(arr[0], arr[1]); 4 | var count = 0; 5 | 6 | for (var j = 1; j < Infinity; j++) { 7 | for (var i = min; i <= max; i++) { 8 | var res = j / i; 9 | if (res % 1 === 0) { 10 | count += 1; 11 | if (count === max) return j; 12 | } 13 | } 14 | count = 0; 15 | } 16 | } -------------------------------------------------------------------------------- /FCC/Day12/oleg.js: -------------------------------------------------------------------------------- 1 | function mutation(arr) { 2 | var result = true; 3 | arr[0] = arr[0].toLowerCase(); 4 | arr[1] = arr[1].toLowerCase(); 5 | 6 | var strToArr = arr[1].split(''); 7 | for (var i = 0; i < strToArr.length; i++) { 8 | var c = strToArr.pop(); 9 | var idx = arr[0].indexOf(c); 10 | if (idx < 0) { 11 | result = false; 12 | } 13 | } 14 | return result; 15 | } 16 | 17 | console.log(mutation(['Hello', 'helloy'])); -------------------------------------------------------------------------------- /FCC/Day15/romanovsci.js: -------------------------------------------------------------------------------- 1 | function destroyer(arr) { 2 | var resultArr = []; 3 | var tempArr = arr; 4 | 5 | for(var arrIndex = 0; arrIndex < arr.length; arrIndex++){ 6 | for(var i = 1; i < arguments.length; i++){ 7 | if(tempArr[arrIndex] == arguments[i]){ 8 | tempArr[arrIndex] = null; 9 | } 10 | } 11 | } 12 | 13 | for(var i in tempArr){ 14 | if(tempArr[i] != null) 15 | resultArr.push(tempArr[i]); 16 | } 17 | 18 | return resultArr; 19 | } 20 | -------------------------------------------------------------------------------- /FCC/Day25/oleg.js: -------------------------------------------------------------------------------- 1 | function unite(arr1, arr2, arr3) { 2 | var res = []; 3 | var sliced = Array.prototype.slice.call(arguments, 0); 4 | var newArr = sliced.reduce(function (q, w) { 5 | return q.concat(w); 6 | }); 7 | 8 | 9 | for (var i = 0; i < newArr.length; i++) { 10 | if (res.indexOf(newArr[i]) < 0) { 11 | res.push(newArr[i]); 12 | } 13 | } 14 | 15 | return res; 16 | } 17 | 18 | d(unite([1, 2, 3], [5, 2, 1, 4], [2, 1])); -------------------------------------------------------------------------------- /FCC/Day20/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function replace(str, before, after) { 2 | return str.split(' ').map(function(word) { 3 | var afterCopy = after; 4 | 5 | if (word.toLowerCase() !== before) { 6 | return word; 7 | } 8 | 9 | if (before[0].toUpperCase() === word[0]) { 10 | afterCopy = afterCopy[0].toUpperCase() + afterCopy.slice(1); 11 | } 12 | 13 | return afterCopy; 14 | }).join(' '); 15 | } 16 | 17 | console.log(replace("A quick brown fox jumped Jumped over the lazy dog", "jumped", "leaped")); -------------------------------------------------------------------------------- /FCC/Day25/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function unite() { 2 | var args = Array.prototype.slice.call(arguments), out = []; 3 | if (args.length < 2) { 4 | throw new Error('Number of arrays should be 2 or more'); 5 | } 6 | 7 | var all = args.reduce(function(prev, current) { 8 | return prev.concat(current); 9 | }, out); 10 | 11 | return all.filter(function(item, indx, origin) { 12 | return origin.indexOf(item) === indx; 13 | }); 14 | } 15 | 16 | console.log(unite([1, 2, 3], [5, 2, 1, 4], [2, 1])); -------------------------------------------------------------------------------- /FCC/Day31/oleg.js: -------------------------------------------------------------------------------- 1 | function find(arr, func) { 2 | var arg2; 3 | 4 | arg2 = arr.some(function (i) { 5 | return i; 6 | }); 7 | 8 | 9 | if (arg2 === true) { 10 | for (var i = 0; i < arr.length; i++) { 11 | arg2 = func(arr[i]); 12 | if (arg2 === true) { 13 | return arr[i]; 14 | } 15 | } 16 | } 17 | return undefined; 18 | } 19 | 20 | console.log(find([1, 2], function (num) { 21 | return num % 2 === 0; 22 | })); -------------------------------------------------------------------------------- /FCC/Day36/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function add() { 2 | 3 | var checkValid = function(n) { 4 | if (!isNaN(parseFloat(n)) && isFinite(n)) { 5 | return n; 6 | } 7 | 8 | throw new Error('Unvalid number'); 9 | }; 10 | 11 | var args = Array.prototype.slice.call(arguments); 12 | 13 | if (args.length === 2) { 14 | return checkValid(args[0]) + checkValid(args[1]); 15 | } else if (args.length) { 16 | return function(n) { 17 | return checkValid(args[0]) + checkValid(n); 18 | }; 19 | } 20 | } -------------------------------------------------------------------------------- /FCC/Day03/oleg.js: -------------------------------------------------------------------------------- 1 | function palindrome(str) { 2 | var re = /\s|[.,]/gi; 3 | var nStr = str.replace(re, '').toLowerCase(); 4 | var jStr = nStr.split('').reverse().join(''); 5 | return (jStr === nStr) ? true : false; 6 | } 7 | 8 | 9 | function palindromeTwo(str) { 10 | str = str.split('').filter(function (i) { 11 | return i.match(/[A-Za-z]/); 12 | }).join('').toLowerCase(); 13 | 14 | if (str === str.split('').reverse().join('')) { 15 | return true; 16 | } 17 | return false; 18 | } 19 | -------------------------------------------------------------------------------- /FCC/Day20/romanovsci.js: -------------------------------------------------------------------------------- 1 | function replace(str, before, after) { 2 | var wordsArray = str.split(" "); 3 | var replaceIndex = wordsArray.indexOf(before); 4 | var firstLater = ""; 5 | 6 | if(replaceIndex >= 0){ 7 | firstLater = wordsArray[replaceIndex].charAt(0); 8 | var replace = after; 9 | if(firstLater.toUpperCase() == wordsArray[replaceIndex].charAt(0)) 10 | replace = after.charAt(0).toUpperCase() + after.slice(1); 11 | 12 | wordsArray[replaceIndex] = replace; 13 | } 14 | 15 | return wordsArray.join(" "); 16 | } 17 | -------------------------------------------------------------------------------- /FCC/Day36/tsur.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import {equal} from 'assert'; 4 | 5 | function add(n1, n2){ 6 | 7 | const len = arguments.length; 8 | const isNumber = n => !isNaN(parseFloat(n)) && isFinite(n); 9 | 10 | if(len > 1 && !(isNumber(n1) && isNumber(n2))) return; 11 | 12 | else if(len < 2 && !isNumber(n1)) return; 13 | 14 | else return len > 1 ? n1+n2 : n2 => isNumber(n2) ? n1+n2 : undefined; 15 | 16 | } 17 | 18 | equal(add(1)(2), '3'); 19 | equal(add(1,2), '3'); 20 | equal(add(3)(), undefined); 21 | equal(add(3, true), undefined); 22 | -------------------------------------------------------------------------------- /FCC/Day14/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function where(collection, source) { 2 | return collection.filter(function(item) { 3 | var status, key; 4 | 5 | for (key in source) { 6 | if (item[key] === source[key]) { 7 | status = true; 8 | } else { 9 | status = false; 10 | 11 | break; 12 | } 13 | } 14 | 15 | return status; 16 | }); 17 | } 18 | 19 | var data = [ 20 | { first: 'Romeo', last: 'Montague' }, 21 | { first: 'Mercutio', last: null }, 22 | { first: 'Tybalt', last: 'Capulet' } 23 | ]; 24 | console.log(where(data, { last: 'Capulet' })); 25 | -------------------------------------------------------------------------------- /FCC/Day23/romanovsci.js: -------------------------------------------------------------------------------- 1 | 2 | function fearNotLetter(str) { 3 | var letterArray = str.toLowerCase().split(''); 4 | var firstLetter = letterArray[0]; 5 | var lastLetter = letterArray[letterArray.length - 1]; 6 | var resultString = ""; 7 | 8 | for(var i = firstLetter.charCodeAt(0); i < lastLetter.charCodeAt(0); i++){ 9 | if(letterArray.indexOf(String.fromCharCode(i)) < 0){ 10 | resultString += String.fromCharCode(i); 11 | } 12 | } 13 | 14 | return resultString == "" ? undefined : resultString; 15 | } 16 | 17 | 18 | alert(fearNotLetter('aBcE')); -------------------------------------------------------------------------------- /FCC/Day20/oleg.js: -------------------------------------------------------------------------------- 1 | function replace(str, before, after) { 2 | var newAfter = ""; 3 | var newStr = str.split(' '); 4 | console.log(newStr); 5 | for (var i = 0; i < newStr.length; i++) { 6 | if (newStr[i] === before) { 7 | if (before[0] === before[0].toUpperCase()) { 8 | newAfter = after[0].toUpperCase() + after.slice(1); 9 | newStr.splice(i, 1, newAfter); 10 | } else { 11 | newStr.splice(i, 1, after); 12 | } 13 | } 14 | } 15 | return newStr.join(' '); 16 | } 17 | -------------------------------------------------------------------------------- /FCC/Day21/romanovsci.js: -------------------------------------------------------------------------------- 1 | function translate(str) { 2 | var consonant = [ 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'X', 'W', 'Z', 3 | 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'x', 'w', 'z']; 4 | 5 | var strLatters = str.split(''); 6 | 7 | for(var i = 0; i < strLatters.length; i++){ 8 | if(consonant.indexOf(strLatters[i]) >= 0){ 9 | strLatters.push(strLatters.shift()); 10 | i--; 11 | }else{ 12 | break; 13 | } 14 | } 15 | 16 | return strLatters.join('') + "ay"; 17 | } -------------------------------------------------------------------------------- /FCC/Day22/nikitin2009.js: -------------------------------------------------------------------------------- 1 | function pair(str) { 2 | 3 | var arr = str.split(''), 4 | newarr = []; 5 | 6 | for (var i = 0; i < arr.length; i++) { 7 | switch (arr[i]) { 8 | case 'A': 9 | newarr[i] = ['A', 'T']; 10 | break; 11 | 12 | case 'T': 13 | newarr[i] = ['T', 'A']; 14 | break; 15 | 16 | case 'C': 17 | newarr[i] = ['C', 'G']; 18 | break; 19 | 20 | case 'G': 21 | newarr[i] = ['G', 'C']; 22 | break; 23 | } 24 | } 25 | 26 | return newarr; 27 | } 28 | -------------------------------------------------------------------------------- /FCC/Day28/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function sumFibs(num) { 2 | 3 | var isPerfectSquere = function(n) { 4 | var sqrt = Math.sqrt(n) | 0; 5 | 6 | return Math.floor(sqrt*sqrt) === n; 7 | }; 8 | 9 | var isFibo = function(n) { 10 | return isPerfectSquere(5*n*n + 4) || isPerfectSquere(5*n*n - 4); 11 | }; 12 | 13 | var sum = 0; 14 | 15 | // cause of pair 1 in fibo 16 | if (num >= 1) { 17 | sum += 1; 18 | } 19 | 20 | while (num >= 0) { 21 | if (num % 2 == 1 && isFibo(num)) { 22 | sum += num; 23 | } 24 | 25 | num--; 26 | } 27 | 28 | return sum; 29 | } 30 | 31 | console.log(sumFibs(4)); -------------------------------------------------------------------------------- /FCC/Day14/oleg.js: -------------------------------------------------------------------------------- 1 | function where(collection, source) { 2 | var arr = []; 3 | for (var n in collection) { 4 | var last = collection[n].last; // 1 arg last:values // Montague, null, Capulet 5 | var s = source.last; // 2 arg last: value // Capulet 6 | if (last === s) { 7 | arr.push(collection[n]); 8 | } 9 | } 10 | return arr; 11 | } 12 | 13 | where([{ 14 | first: 'Romeo', 15 | last: 'Montague' 16 | }, { 17 | first: 'Mercutio', 18 | last: null 19 | }, { 20 | first: 'Tybalt', 21 | last: 'Capulet' 22 | }], { 23 | last: 'Capulet' 24 | }); 25 | -------------------------------------------------------------------------------- /FCC/Day18/ramkam.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created with Test. 3 | * User: Apaksimen 4 | * Date: 2015-06-12 5 | * Time: 11:25 AM 6 | * To change this template use Tools | Templates. 7 | */ 8 | function diff(arr1, arr2) { 9 | var newArr = []; 10 | arr1.forEach(function(e){ 11 | if (arr2.indexOf(e) === -1) newArr.push(e); 12 | }); 13 | arr2.forEach(function(e){ 14 | if (arr1.indexOf(e) === -1) newArr.push(e); 15 | }); 16 | return newArr; 17 | } 18 | 19 | 20 | //d(diff([1, 2, 3, 5], [1, 2, 3, 4, 5])); 21 | 22 | // tbd: make it work on objects : c =[ { a:1, b:2 }, {a:2, b: 3 } ]; d = [ { a: 1, b: 2 }, {a: 5, b : 7 } ]; 23 | -------------------------------------------------------------------------------- /FCC/Day30/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function smallestCommons(arr) { 2 | var min = Math.min.apply(null, arr), 3 | max = Math.max.apply(null, arr), 4 | nums = [], 5 | smallest = 1, 6 | lastResult = false, 7 | i; 8 | 9 | for (; min <= max; min++) { 10 | nums.push(min); 11 | } 12 | 13 | while (smallest >= 0) { 14 | 15 | for (i = 0; i < nums.length; i++) { 16 | if (smallest % nums[i] !== 0) { 17 | lastResult = false; 18 | break; 19 | } 20 | 21 | lastResult = true; 22 | } 23 | 24 | if (lastResult) { 25 | return smallest; 26 | } else { 27 | ++smallest; 28 | } 29 | 30 | } 31 | } 32 | 33 | console.log(smallestCommons([1,5])); -------------------------------------------------------------------------------- /Projects/Project-1/P9gehka/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Quiz 6 | 7 | 17 | 18 | 19 |
20 |

we <3 JS:))

21 |
22 |
23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /FCC/Day21/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function translate(str) { 2 | var vowels = ['a', 'e', 'i', 'o', 'u', 'y']; 3 | 4 | var addSufix = function(startsWithVowel) { 5 | return startsWithVowel ? str.join('') + 'way' : str.join('') + 'ay'; 6 | }; 7 | 8 | var checkVowel = function(char) { 9 | return vowels.indexOf(char.toLowerCase()) > -1; 10 | }; 11 | 12 | str = str.split(''); 13 | 14 | for (var i = 0; i < str.length; i++) { 15 | var isVowel = checkVowel(str[0]); 16 | 17 | if (i === 0 && isVowel) { 18 | return addSufix(true); 19 | } 20 | 21 | if (isVowel) { 22 | return addSufix(); 23 | } 24 | 25 | str.push(str.shift()); 26 | } 27 | 28 | return addSufix(); 29 | } 30 | 31 | console.log(translate("consonant")); -------------------------------------------------------------------------------- /FCC/Day19/lukyanovfedor.js: -------------------------------------------------------------------------------- 1 | function convert(num) { 2 | var nums = [ 3 | { 4 | value: 1000, 5 | sign: 'M', 6 | }, 7 | { 8 | value: 900, 9 | sign: 'CM', 10 | }, 11 | { 12 | value: 500, 13 | sign: 'D', 14 | }, 15 | { 16 | value: 400, 17 | sign: 'CD', 18 | }, 19 | { 20 | value: 100, 21 | sign: 'C', 22 | }, 23 | { 24 | value: 90, 25 | sign: 'XC', 26 | }, 27 | { 28 | value: 50, 29 | sign: 'L', 30 | }, 31 | { 32 | value: 40, 33 | sign: 'XL', 34 | }, 35 | { 36 | value: 10, 37 | sign: 'X', 38 | }, 39 | { 40 | value: 9, 41 | sign: 'IX', 42 | }, 43 | { 44 | value: 5, 45 | sign: 'V', 46 | }, 47 | { 48 | value: 4, 49 | sign: 'IV', 50 | }, 51 | { 52 | value: 1, 53 | sign: 'I', 54 | } 55 | ]; 56 | 57 | var out = ''; 58 | 59 | nums.forEach(function(item) { 60 | while (num >= item.value) { 61 | out += item.sign; 62 | num -= item.value; 63 | } 64 | }); 65 | 66 | return out; 67 | } 68 | 69 | console.log(convert(36)); -------------------------------------------------------------------------------- /FCC/Day23/oleg.js: -------------------------------------------------------------------------------- 1 | function fearNotLetter(str) { 2 | var len = str.length; 3 | var sCD = 0; 4 | var n = ''; 5 | var result; 6 | 7 | var a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; 8 | 9 | for (var i = 0; i < a.length; i++) { 10 | 11 | if (a[i] === str[0]) { 12 | for (var j = i; j < len + i; j++) { 13 | n += a[j]; 14 | var idx = a[j]; 15 | var idx2 = str[j - i]; 16 | var aCD = idx.charCodeAt(); 17 | sCD = idx2.charCodeAt(); 18 | 19 | console.log(idx + ' idx'); 20 | console.log(idx2 + ' idx2'); 21 | console.log(sCD + ' sCD'); 22 | console.log(aCD + ' aCD'); 23 | 24 | if (sCD != aCD) { 25 | return a[j]; 26 | } 27 | 28 | 29 | } 30 | if (n === str) { 31 | return result; 32 | } 33 | 34 | } 35 | } 36 | 37 | } 38 | 39 | console.log(fearNotLetter('ac')); -------------------------------------------------------------------------------- /FCC/Day27/oleg.js: -------------------------------------------------------------------------------- 1 | function spinalCase(str) { 2 | var reg = /\s/gi, 3 | found = "", 4 | newArr = []; 5 | str = str.replace(/[_\W+]/gi, ' '); 6 | 7 | if (str.match(reg)) { 8 | return str.replace(/\s+/gi, '-').toLowerCase(); 9 | } else { 10 | str = str + 'A'; 11 | str = str[0].toUpperCase() + str.substr(1, str.length); 12 | upper: 13 | for (var i = 0; i < str.length; i++) { 14 | found = ""; 15 | if (str[i] === str[i].toUpperCase()) { // naxodit zaglavnuju 16 | inner: for (var j = i; j < str.length - 1; j++) { 17 | found += str[j]; 18 | if (str[j + 1] === str[j + 1].toUpperCase()) { 19 | newArr.push(found); 20 | break inner; 21 | } 22 | } 23 | } 24 | } 25 | 26 | return newArr.join(' ').replace(/\s+/gi, '-').toLowerCase(); 27 | } 28 | 29 | } 30 | 31 | //d(spinalCase('The_Andy_Griffith_Show')); 32 | //d(spinalCase('This Is Spinal Tap')); 33 | //d(spinalCase('Teletubbies say Eh-oh')); 34 | //d(spinalCase('ThisIsSpinalTap')); 35 | //d(spinalCase('thisIsSpinalTap')); -------------------------------------------------------------------------------- /FCC/Day21/oleg.js: -------------------------------------------------------------------------------- 1 | function translate(str) { 2 | var firstLetter = "", 3 | secondLetter = ""; 4 | var newStr = "", 5 | joined = ""; 6 | var vowels = ['a', 'e', 'i', 'o', 'u']; 7 | var cons = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']; 8 | 9 | for (var i = 0; i < cons.length; i++) { 10 | if (str[0] === cons[i]) { 11 | newStr = str.split(''); 12 | firstLetter = newStr.shift(); 13 | joined = newStr.join(''); 14 | for (var z = 0; z < cons.length; z++) { 15 | if (joined[0] === cons[z]) { 16 | newStr = joined.split(''); 17 | secondLetter = newStr.shift(); 18 | joined = newStr.join(''); 19 | return joined + firstLetter + secondLetter + "ay"; 20 | } 21 | } 22 | return joined + firstLetter + "ay"; 23 | } else if (str[0] === vowels[i]) { 24 | str = str + "way"; 25 | return str; 26 | } 27 | } 28 | } 29 | 30 | console.log(translate("consonant")); 31 | console.log(translate("dansonants")); 32 | console.log(translate("ego")); 33 | console.log(translate("glove")); 34 | console.log(translate("paragraphs")); -------------------------------------------------------------------------------- /Projects/Project-1/README.md: -------------------------------------------------------------------------------- 1 | # Project-1 2 | 3 | **Project-1 Description** 4 | 5 | Welcome to Project Channel 1! 6 | *to be involved in a project, join #project-1 channel on slack* 7 | 8 | Let’s start with a quiz! 9 | We’re going to be building a Javascript Quiz web application. This will be a simple app that uses HMTL, CSS and JS and it should have the following functionality: 10 | It will be a multiple choice quiz that has radio buttons and it keeps track of the user’s score 11 | A minimum number of 5 questions should be added however you can add as much as you want 12 | When the quiz is complete. Sum up the user’s score and display the answer to them. 13 | Store your questions in an array. Each question, along with its choices and correct answer. 14 | ```javascript 15 | var allQuestions = [{question: "Who is Prime Minister of the United Kingdom?", choices: ["David Cameron", "Gordon Brown", "Winston Churchill", "Tony Blair"], correctAnswer:0}]; 16 | ``` 17 | Dynamically (with document.getElementById or jQuery) remove the current question and add the next question, when the user clicks the “Next” button. The Next button will be the only button to navigate this version of the quiz. 18 | 19 | 20 | *Ask a mentor for help if you feel stuck, or you don’t know where to start. 21 | Check a table in the end of the file to see who is a mentor now.* 22 | 23 | **Preparation material** 24 | 25 | 26 | ###HTML 27 | * http://howtocodeinhtml.com/ Getting started with HTML5 and CSS3 28 | * https://developer.mozilla.org/en-US/Learn/Getting_started_with_the_web/HTML_basics 29 | * http://www.w3schools.com/html/default.asp 30 | 31 | ###CSS 32 | * http://tympanus.net/codrops/css_reference/ css reference 33 | * http://toolness.github.io/css-selector-game/ practice selectors 34 | * http://flukeout.github.io/ learning selectors properly in a game 35 | 36 | 37 | ###JS 38 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide 39 | * http://javascript.info/ 40 | 41 | 42 | ###Ready-made Example Quizzes 43 | 44 | * http://jsfiddle.net/3q8fs/3/ 45 | * http://codepen.io/lonekorean/pen/bfAjD 46 | * http://codepen.io/cmcg/pen/dlxvu 47 | * http://jsfiddle.net/3kpFV/ 48 | * http://javascriptissexy.com/how-to-learn-javascript-properly/ 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Git guide.md: -------------------------------------------------------------------------------- 1 | ## How to use Git 2 | ___ 3 | 4 | ### Using git to push your solution to our repo: 5 | 6 | 1. Download git. For downloading latest version of git go to http://git-scm.com/downloads and choose version for your operating system. 7 | 2. Open git-bash, create new folder, where you will be storing your project and initialize git. 8 | Commands: 9 | + Create folder: **mkdir folderName** 10 | + Go to folder: **cd folderName** 11 | + Initialize git: **git init** 12 | 13 | ![Picture-1](http://i.imgur.com/aNGVAdz.jpg) 14 | 15 | 3. Create a working copy of a local repository by running the command: 16 | + **git clone https://github.com/welearnjs/Main.git** 17 | 18 | 19 | ![Picture-2](http://i.imgur.com/kqgSGyx.jpg) 20 | 21 | 4. Go to /Challenges folder and change branch from master to challenges. 22 | Commands: 23 | + Go to /Challenges: **cd /Challenges** 24 | + Change branch: **git checkout challenges** 25 | 26 | ![Picture-3](http://i.imgur.com/8N4cYao.jpg) 27 | 28 | 5. And now you can solve tasks and copy your solutions to an appropriate folder. For example I’ve added "ExampleDay1.js" file to the folder (/Challenges/FCC/Day1). After running command "git status" you can see a list of files which are untracked. The git status command displays the state of the working directory. 29 | Commands: 30 | + Check git status: **git status** 31 | 32 | ![Picture-4](http://i.imgur.com/LlG9WYM.jpg) 33 | 34 | 6. Now you need to make a file tracked by running command "git add ExampleDay1.js". It‘s good practice to check the state of your repository before committing changes so that you don’t accidentally commit something you don't mean to. 35 | Commands: 36 | + Add file: **git add ExampleDay1.js** (or "git add *", will add all files) 37 | + Check git status: **git status** 38 | 39 | ![Picture-5](http://i.imgur.com/HD6pGnU.jpg) 40 | 41 | 42 | 7. To actually commit these changes use: git commit -m “Your comment”. Now the file is committed, but not in your remote repository yet. Note: comment should be meaningful 43 | Commands: 44 | + Commit file: git commit -m “Your comment” 45 | + Git status: git status 46 | 47 | ![Picture-6](http://i.imgur.com/1FNREjr.jpg) 48 | 49 | 8. Your changes are now in the HEAD of your local working copy. To send those changes to your remote repository, execute git push origin challenges. And after we can see our file on remote repository on github.com 50 | Commands: 51 | + Push committed file to remote repository: git push origin challenges 52 | 53 | ![Picture-7](http://i.imgur.com/KUTKPDO.jpg) 54 | ![Picture-8](http://i.imgur.com/l4VEoUd.jpg) 55 | 56 | 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Welcome! 2 | ### What is WeLearnJS? 3 | ___ 4 | 5 | > WeLearnJS is a Slack group, originally created by __[Marina](https://twitter.com/welearnjs)__ is for self-organised people, who are willing to learn JS properly. We are a self motivating group of individuals that support each other through the process of javascript learning with an ongoing series of projects/challenges. We believe that the best way to learn and become an expert in something is by doing and we also believe that you truly concrete your knowledge when you can teach others. Our group is based on this simple concept - Learn by doing then teach others. 6 | ___ 7 | 8 | 9 | ### 4 Easy steps to get started with this Slack group: 10 | 11 | 1. Register to __[Our Slack Team](http://javascript-devs.herokuapp.com/)__ 12 | 2. Tell us where are you from in **#intros** channel or say that secret password that connects people, *hint*: h***o! 13 | 3. Choose your path 14 | 1. *For beginners*, feeling uncomfortable with Javascript basics, we suggest to start doing: 15 | + __[Study Guide](https://github.com/welearnjs/Challenges/blob/master/Study%20Guide/Study%20Guide.md)__ made and approved by our group members, discussions in channel **#study-guide** 16 | + Challenges that we take from other resources and share solutions with each other, discussions: **#challenges**. 17 | Current challenges: 18 | - __[FreeCodeCamp](https://github.com/welearnjs/Challenges/tree/master/FCC)__ 19 | 2. *For others (beginners to more experienced)* we have an ongoing series of open-source projects that you can join to solidify your knowledge and build up your portfolio. Every project has it's own **#project** channel and a 'Project Guide' to use as a starting point. By finishing a project you become a mentor. A *mentor* at WeLearnJS, is someone who has finished a project/challenges/etc and is therefore qualified to help others finish that project. This simple idea allows for anyone who is a mentor to continuously hone their skills. It also gives the beginner’s someone to turn to for help. 20 | You can start your own project and build a team around it, we would consider all the suggestions added to the **#getting-started** channel. 21 | Current projects: 22 | - __[#project-1 guide](https://github.com/welearnjs/Challenges/tree/master/Projects/Project-1)__ individual project 23 | - **Current status:** Start any time, when finished, share your solution __[here](https://github.com/welearnjs/Main/tree/master/Projects/Project-1)__ for feedback 24 | - __[#project-2](https://github.com/welearnjs/helpersApp)__ group project 25 | - **Current status:** enrollment has ended, but still possible to join by leaving your github account in **#project-2** channel. 26 | - project-3 soon to be announced 27 | 28 | 29 | ___ 30 | ### Ways of Getting mentors badge 31 | 32 | > To get recognition for everything members are doing in the group we have a simple badge system, every badge that you acquire would link to your Github profile. Badge is a justification of your activity and progress, so other developers/learners and even entrepreneurs seeking active people would know whom to refer to. We want every member to succeed, and be well-respected not only in the Slack community but outside of it too. 33 | 34 | #### You acquire a badge automatically if you are: 35 | 36 | + actively helping members in the community 37 | + finished the study guide and helping others with it 38 | + doing challenges / share solutions 39 | + doing projects / share solutions 40 | + creating your own challenges/projects 41 | + any other forms of activity will be also rewarded 42 | 43 | ...if we missed out your activity, please let us know 44 | 45 | --- 46 | 47 | #### Example 48 | 49 | * Slack username linking to github profile : Status : Field of Activity 50 | 51 | 52 | | Github | Badge | 53 | | ------ | ----------- | 54 | | __[p9gehka](https://github.com/welearnjs)__ | ![p-1](http://i.imgur.com/xpdc0wn.png) ![FCC](http://i.imgur.com/teM4A62.png)| 55 | | __[Imanuel](https://github.com/welearnjs)__ | ![p-1](http://i.imgur.com/xpdc0wn.png) ![starter-1](http://i.imgur.com/j73IMb7.png) | 56 | | __[Oleg](https://github.com/welearnjs)__ | ![p-1](http://i.imgur.com/xpdc0wn.png) ![FCC](http://i.imgur.com/teM4A62.png) ![starter-1](http://i.imgur.com/j73IMb7.png)| 57 | | __[romanovsci](https://github.com/welearnjs)__ | ![FCC](http://i.imgur.com/teM4A62.png) | 58 | | __[lukyanovfedor](https://github.com/welearnjs)__ | ![FCC](http://i.imgur.com/teM4A62.png) | 59 | 60 | 61 | Current badges to acquire: 62 | 63 | * ![starter-2](http://i.imgur.com/3X2poWc.png) - came up with idea for the project-2 64 | * ![starter-1](http://i.imgur.com/j73IMb7.png) - came up with idea for the project-1 65 | * ![p-1](http://i.imgur.com/xpdc0wn.png) - finished project-1, qualified to help others 66 | * ![p-2](http://i.imgur.com/chhyuw4.png) - finished project-2, qualified to help others 67 | * ![FCC](http://i.imgur.com/teM4A62.png) - finished FCC challenges, qualified to help others 68 | * ![study-gd](http://i.imgur.com/P5iCfRz.png) - finished study-guide, qualified to help others 69 | * ![code-reviewer](http://i.imgur.com/mXs64t0.png) - reviewed code on project-2 70 | 71 | --- 72 | # Good luck and have fun learning! 73 | 74 | 75 | -------------------------------------------------------------------------------- /Projects/Project-1/P9gehka/quiz.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | //Sorry for the mistakes in the comments 3 | //English is not my native language 4 | var MakeQuiz, quiz, allQuestion, addClass, Button, addClasses; 5 | //make array of questions, choices and correctAnswer 6 | allQuestion = [{question: "What value return this code [] + []?", choices: ['""', "[]", "Nan", "0"], correctAnswer:0}]; 7 | allQuestion.push({question: "And now [] + {}?", choices: ['""', "[]", "Nan", "[object Object]"], correctAnswer:3}); 8 | allQuestion.push({question: "What about OR null || 2 || undefined?'", choices: ['null', "undefined", "2", "false"], correctAnswer:2}); 9 | allQuestion.push({question: "... AND 1 && null && 2?'", choices: ['null', "true", "1", "2"], correctAnswer:0}); 10 | allQuestion.push({question: "Last... null + 1 = 1?'", choices: ['null', "1", "Nun", "'null1'"], correctAnswer:1}); 11 | 12 | //some function for help 13 | addClass = function (elem, clazz) { 14 | var c = elem.className.split(' '); 15 | for(var i=0; iStudy guide is constantly updating by the __[WeLearnJS Javascript Community on Slack](http://javascript-devs.herokuapp.com/)__ members, get back and check it out! 5 | 6 | **before the start:** 7 | + leave your github username in **#getting-started** channel 8 | + join the channel **#study-guide** for questions/discussion/issues 9 | 10 | This study guide is intended for beginners entering the field of web-development. Each week will contain a task + additional reading + resources to fill in the knowledge gaps. You can choose whatever suits you best, a good book or a combination of resources, you decide. After finishing this guide or somewhere in the middle you will be able to start doing - __[Projects](https://github.com/welearnjs/Challenges/tree/master/Projects)__ 11 | 12 | Our main book throughout the weeks is 13 | + Nicholas C. Zakas, Professional Javascript for Web Developers, 3rd edition 14 | 15 | Abbreviations that we use 16 | + **YDKJS** - You Don’t Know Javascript Book 17 | + **FCC** - __[FreeCodeCamp](http://www.freecodecamp.com/)__ 18 | 19 | ___ 20 | 21 | #### Week 1: CLI and Git 22 | 23 | **Tasks** 24 | 25 | 1. https://try.github.io/levels/1/challenges/1 practice using git 26 | 2. Following our guide please add a ‘yournickname.js’ file to our repo 27 | to: Study Guide / Week1 / yournickname.js 28 | 29 | **WeLearnJS Git guide** 30 | * __[How to use git](https://github.com/welearnjs/Main/blob/master/Git%20guide.md)__ 31 | 32 | **Reading** 33 | * https://git-scm.com/book/en/v2 Git online book 34 | 35 | **Additional Resources:** 36 | * https://help.github.com/articles/set-up-git/ setting up / the official guide 37 | * http://tech.pro/tutorial/1939/setting-up-git-on-windows-with-tortoisegit-and-github for windows users 38 | * https://www.atlassian.com/git/ pretty good work through for Git 39 | * https://goo.gl/qLs8hJ Setting up A repository, another tutorial 40 | * http://rogerdudler.github.io/git-guide/ Git - simple guide 41 | * http://wildlyinaccurate.com/a-hackers-guide-to-git/ A Hacker’s Guide to Git 42 | * http://goo.gl/ClPI5v Git for everyone, online book 43 | * http://alistapart.com/article/get-started-with-git get started 44 | * http://goo.gl/lzKySv Github for beginners 45 | * http://goo.gl/UHSj9L A step by step guide to setting up a new Github account 46 | * https://goo.gl/cJNnB7 Managing Deploy Keys 47 | 48 | 49 | #### Week 2: HTML/CSS 50 | 51 | **Tasks:** 52 | 53 | 1. FCC: HTML/CSS 1-45 54 | 2. http://toolness.github.io/css-selector-game/ practice selectors in a game 55 | 3. http://flukeout.github.io/ learning selectors properly in a game 56 | 57 | **Reading** 58 | * http://howtocodeinhtml.com/ Getting started with HTML5 and CSS3 59 | 60 | **Additional Resources:** 61 | * http://callmenick.com/post/the-new-box-sizing-reset CSS Reset 62 | * https://docs.webplatform.org/wiki/html/tutorials (recommended by Aaron) 63 | * https://docs.webplatform.org/wiki/css/tutorials (recommended by Aaron) 64 | * http://mdo.github.io/code-guide/ main rules, etc 65 | * http://learn.shayhowe.com/html-css/ theory along practice 66 | * http://tympanus.net/codrops/css_reference/ css reference 67 | * http://www.smashingmagazine.com/2009/06/15/take-your-design-to-the-next-level-with-css3/ Compliments JeffreyWay’s “The Important CSS Selectors” 68 | * https://css-tricks.com/the-lengths-of-css/ and http://demosthenes.info/blog/775/Which-CSS-Measurements-To-Use-When Short read on CSS Measurements 69 | * http://callmenick.com/post/flexbox-examples Layout 70 | * http://www.smashingmagazine.com/2009/08/04/designing-a-html-5-layout-from-scratch/ Try out building another layout 71 | * https://www.udacity.com/course/responsive-web-design-fundamentals--ud893 72 | 73 | #### Week 3: jQuery 74 | (Quick Intro) 75 | 76 | **Tasks:** 77 | 78 | 1. FCC: jQuery 1-5 79 | 2. JavaScript/HTML/jQuery Interactive Website: http://www.codecademy.com/skills/make-an-interactive-website 80 | 3. http://try.jquery.com/ 81 | 82 | **Additional Resources:** 83 | * https://learn.jquery.com/ (events, effects, ajax) 84 | * http://jqfundamentals.com/ 85 | * http://www.tutorialspoint.com/jquery/jquery-quick-guide.htm jQuery quick guide 86 | * http://oscarotero.com/jquery/ jquery reference 87 | 88 | #### Week 4-5: JS Fundamentals 89 | (Introduction, Data Types, Expressions, Operators, and Objects) 90 | 91 | **Tasks:** 92 | 93 | 1. FCC: Basic JavaScript 1-10 94 | 2. Chrome Dev Tools (developer.chrome.com): https://developer.chrome.com/devtools 95 | 3. JavaScript Basics (codecademy.com): www.codecademy.com/tracks/javascript 96 | 4. Challenges: Dash Projects https://dash.generalassemb.ly/ 97 | 98 | **Reading** 99 | * Zakas Chapter 3: Language Basics 100 | * https://goo.gl/hcuwjE YDKJS Intro 101 | * Zakas Chapter 4: Variables, Scope, and Memory 102 | * http://goo.gl/NF6nKj JavascriptIsSexy: Variable Scope and Hoisting 103 | * Zakas Chapter 5: Reference Types 104 | * Working with JavaScript Dates and Times http://javascript.info/tutorial/datetime-functions 105 | 106 | **Additional Resources:** 107 | https://docs.webplatform.org/wiki/javascript (recommended by Aaron) 108 | 109 | #### Week 6-8: JS Objects 110 | 111 | **Tasks:** 112 | 113 | From this point you can start sharing your solution __[Here](https://github.com/welearnjs/Challenges/tree/master/FCC)__ and push your solutions to our github for feedback 114 | 115 | 1. FCC: Object Oriented JavaScript 1-9 116 | 2. FCC Basic Algorithm Scripting 1-8 117 | 118 | **Reading** 119 | * JavaScript Objects (javascriptissexy.com): http://javascriptissexy.com/javascript-objects-in-detail/ 120 | * Zakas Chapter 6: Object-Oriented Programming 121 | * http://sporto.github.io/blog/2013/02/22/a-plain-english-guide-to-javascript-prototypes/ 122 | * http://javascriptissexy.com/javascript-prototype-in-plain-detailed-language/ 123 | * http://javascriptissexy.com/oop-in-javascript-what-you-need-to-know/ 124 | * Sebastians Blog : Plain English Guide to JS Prototypes http://goo.gl/Hl0oA 125 | * YDKJS: Chapter on Objects - https://goo.gl/pK9Chy 126 | 127 | #### Week 9-11: JS Functions 128 | 129 | **Tasks:** 130 | 131 | 1. FCC Basic Algorithm Scripting 9-16 132 | 2. FCC Functional Programming Waypoint 1: Practice Functional Programming 133 | 134 | **Reading** 135 | Zakas Chapter 7: Function Expressions 136 | 137 | **Additional Resources (suggested for reading/studying)** 138 | * https://goo.gl/HJ5pCi YDKJS: Scopes and Closures: 139 | * https://goo.gl/pK9Chy YDKJS: Chapter on ‘this’ - 140 | * https://goo.gl/ATfHpC Understanding JS closures 141 | * http://goo.gl/fLdUMv Closures: front and back 142 | * http://goo.gl/hUfHjo JavascriptIsSexy: Understanding closures 143 | * http://goo.gl/vLcj5k JavaScript this 144 | * http://goo.gl/qLaaqx Function Declarations and Expressions 145 | 146 | 147 | 148 | #### Week 12-14: DOM, Regular Expressions, Window Object, Events 149 | 150 | **Tasks** 151 | 152 | 1. FCC Basic Algorithm Scripting 17-20 153 | 2. Go to channel #project-1 on Slack and start __[#project-1](https://github.com/welearnjs/Challenges/tree/master/Projects/Project-1)__ which is a dynamic Quiz App, and push your solution to our github for feedback. 154 | 155 | **Reading** 156 | * Zakas Chapter 8: The Browser Object Model 157 | * Zakas Chapter 10: The Document Object Model 158 | * Zakas Chapter 11: DOM Extensions 159 | * Zakas Chapter 13: Events 160 | * Zakas Chapter 14: Scripting Forms 161 | * Zakas Chapter 20: JSON 162 | * Zakas Chapter 23: Offline Applications and Client-Side Storage 163 | 164 | 165 | #### Week 15: HTML5, Practice 166 | 167 | **Tasks** 168 | 169 | 1. FCC Basic Algorithm Scripting 21-38 170 | 2. FCC Intermediate Algorithm Scripting 1-3 171 | 3. FCC Front End Development Projects: Pick one 172 | 173 | **Reading** 174 | * Zakas Chapter 16: HTML5 Scripting 175 | * Zakas Chapter 22: Advanced Techniques 176 | * Zakas Chapter 24: Best Practices 177 | 178 | 179 | 180 | -------------------------------------------------------------------------------- /FCC/README.md: -------------------------------------------------------------------------------- 1 | Day 36 2 | ```javascript 3 | function add() { 4 | return false; 5 | } 6 | add(2,3); 7 | ``` 8 | Create a function that sums two arguments together. If only one argument is provided, return a function that expects one additional argument and will return the sum. 9 | For example, add(2, 3) should return 5, and add(2) should return a function that is waiting for an argument so that var sum2And = add(2); return sum2And(3); // 5 10 | If either argument isn't a valid number, return undefined. 11 | 12 | Day 35 13 | ```javascript 14 | function every(collection, pre) { 15 | // Does everyone have one of these? 16 | return pre; 17 | } 18 | every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex'); 19 | ``` 20 | Check if the predicate (second argument) returns truthy (defined) for all elements of a collection (first argument). 21 | For this, check to see if the property defined in the second argument is present on every element of the collection. 22 | Remember, you can access object properties through either dot notation or [] notation. 23 | 24 | Day 34 25 | ```javascript 26 | function binaryAgent(str) { 27 | return str; 28 | } 29 | 30 | binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111'); 31 | ``` 32 | Return an English translated sentence of the passed binary string. 33 | The binary string will be space separated. 34 | 35 | Day 33 36 | ```javascript 37 | function steamroller(arr) { 38 | // I'm a steamroller, baby 39 | return arr; 40 | } 41 | 42 | steamroller([1, [2], [3, [[4]]]]); 43 | ``` 44 | Flatten a nested array. You must account for varying levels of nesting. 45 | 46 | Day 32 47 | ```javascript 48 | function drop(arr, func) { 49 | // Drop them elements. 50 | return arr; 51 | } 52 | drop([1, 2, 3], function(n) {return n < 3; }); 53 | ``` 54 | Drop the elements of an array (first argument), starting from the front, until the predicate (second argument) returns true. 55 | 56 | Day 31 57 | ```javascript 58 | function find(arr, func) { 59 | var num = 0; 60 | return num; 61 | } 62 | find([1, 2, 3, 4], function(num){ return num % 2 === 0; }); 63 | ``` 64 | 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). 65 | 66 | Day 30 67 | ```javascript 68 | function smallestCommons(arr) { 69 | return arr; 70 | } 71 | smallestCommons([1,5]); 72 | ``` 73 | Find the smallest number that is evenly divisible by all numbers in the provided range.The range will be an array of two numbers that will not necessarily be in numerical order. 74 | 75 | Day 29 76 | ```javascript 77 | function sumPrimes(num) { 78 | return num; 79 | } 80 | sumPrimes(10); 81 | ``` 82 | Sum all the prime numbers up to and including the provided number. 83 | A prime number is defined as having only two divisors, 1 and itself. For example, 2 is a prime number because it's only divisible by 1 and 2. 1 isn't a prime number, because it's only divisible by itself. 84 | 85 | Day 28 86 | ```javascript 87 | function sumFibs(num) { 88 | return num; 89 | } 90 | sumFibs(4); 91 | ``` 92 | Return the sum of all odd Fibonacci numbers up to and including the passed number if it is a Fibonacci number. 93 | The first few numbers of the Fibonacci sequence are 1, 1, 2, 3, 5 and 8, and each subsequent number is the sum of the previous two numbers. 94 | As an example, passing 4 to the function should return 5 because all the odd Fibonacci numbers under 4 are 1, 1, and 3. 95 | 96 | Day 27 97 | ```javascript 98 | function spinalCase(str) { 99 | // "It's such a fine line between stupid, and clever." 100 | // --David St. Hubbins 101 | return str; 102 | } 103 | 104 | spinalCase('This Is Spinal Tap'); 105 | ``` 106 | Convert a string to spinal case. Spinal case is all-lowercase-words-joined-by-dashes. 107 | 108 | Day 26 109 | ```javascript 110 | function convert(str) { 111 | // :) 112 | return str; 113 | } 114 | 115 | convert('Dolce & Gabbana'); 116 | 117 | ``` 118 | Convert the characters "&", "<", ">", '"' (double quote), and "'" (apostrophe), in a string to their corresponding HTML entities. 119 | 120 | Day 25 121 | ```javascript 122 | function unite(arr1, arr2, arr3) { 123 | return arr1; 124 | } 125 | 126 | unite([1, 2, 3], [5, 2, 1, 4], [2, 1]); 127 | ``` 128 | Write a function that takes two or more arrays and returns a new array of unique values in the order of the original provided arrays. 129 | In other words, all values present from all arrays should be included in their original order, but with no duplicates in the final array. 130 | The unique numbers should be sorted by their original order, but the final array should not be sorted in numerical order. 131 | 132 | Day 24 133 | ```javascript 134 | function boo(bool) { 135 | // What is the new fad diet for ghost developers? The Boolean. 136 | return bool; 137 | } 138 | 139 | boo(null); 140 | ``` 141 | Check if a value is classified as a boolean primitive. Return true or false. 142 | Boolean primitives are true and false. 143 | 144 | Day 23 145 | ```javascript 146 | function fearNotLetter(str) { 147 | return str; 148 | } 149 | 150 | fearNotLetter('abce'); 151 | ``` 152 | Find the missing letter in the passed letter range and return it. 153 | If all letters are present in the range, return undefined. 154 | 155 | Day 22 156 | ```javascript 157 | function pair(str) { 158 | return str; 159 | } 160 | 161 | pair("GCG"); 162 | ``` 163 | The DNA strand is missing the pairing element. Match each character with the missing element and return the results as a 2d array. 164 | Base pairs are a pair of AT and CG. Match the missing element to the provided character. 165 | Return the provided character as the first element in each array. 166 | 167 | 168 | Day 21 169 | ```javascript 170 | function translate(str) { 171 | return str; 172 | } 173 | 174 | translate("consonant"); 175 | 176 | ``` 177 | Translate the provided string to pig latin. 178 | Pig Latin takes the first consonant (or consonant cluster) of an English word, moves it to the end of the word and suffixes an "ay".If a word begins with a vowel you just add "way" to the end. 179 | 180 | Day 20 181 | ```javascript 182 | function replace(str, before, after) { 183 | return str; 184 | } 185 | 186 | replace("A quick brown fox jumped over the lazy dog", "jumped", "leaped"); 187 | ``` 188 | Perform a search and replace on the sentence using the arguments provided and return the new sentence. 189 | First argument is the sentence to perform the search and replace on. 190 | Second argument is the word that you will be replacing (before). 191 | Third argument is what you will be replacing the second argument with (after). 192 | NOTE: Preserve the case of the original word when you are replacing it. For example if you mean to replace the word 'Book' with the word 'dog', it should be replaced as 'Dog' 193 | 194 | Day 19 195 | ```javascript 196 | function convert(num) { 197 | return num; 198 | } 199 | convert(36); 200 | ``` 201 | Convert the given number into a roman numeral. 202 | All roman numerals answers should be provided in upper-case. 203 | 204 | Day 18 205 | ```javascript 206 | function diff(arr1, arr2) { 207 | var newArr = []; 208 | // Same, same; but different. 209 | return newArr; 210 | } 211 | diff([1, 2, 3, 5], [1, 2, 3, 4, 5]); 212 | ``` 213 | Compare two arrays and return a new array with any items not found in both of the original arrays. 214 | 215 | Day 17 216 | ```javascript 217 | function sumAll(arr) { 218 | return(1); 219 | } 220 | sumAll([1, 4]); 221 | ``` 222 | We'll pass you an array of two numbers. Return the sum of those two numbers and all numbers between them. 223 | The lowest number will not always come first. 224 | 225 | Day 16 226 | ```javascript 227 | function where(arr, num) { 228 | // Find my place in this sorted array. 229 | return num; 230 | } 231 | where([40, 60], 50); 232 | ``` 233 | Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument). For example, where([1,2,3,4], 1.5) should return 1 because it is greater than 1 (0th index), but less than 2 (1st index). 234 | 235 | Day 15 236 | ```javascript 237 | function destroyer(arr) { 238 | // Remove all the values 239 | return arr; 240 | } 241 | destroyer([1, 2, 3, 1, 2, 3], 2, 3); 242 | ``` 243 | You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments. 244 | 245 | Day 14 246 | ```javascript 247 | function where(collection, source) { 248 | var arr = []; 249 | // What's in a name? 250 | return arr; 251 | } 252 | where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }); 253 | ``` 254 | Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument). 255 | 256 | Day 13 257 | ```javascript 258 | function bouncer(arr) { 259 | // Don't show a false ID to this bouncer. 260 | return arr; 261 | } 262 | bouncer([7, 'ate', '', false, 9]); 263 | ``` 264 | Remove all falsey values from an array. 265 | 266 | Falsey values in javascript are false, null, 0, "", undefined, and NaN. 267 | 268 | Day 12 269 | ```javascript 270 | function mutation(arr) { 271 | return arr; 272 | } 273 | mutation(['hello', 'hey']); 274 | ``` 275 | Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array. 276 | 277 | Day 11 278 | ```javascript 279 | function slasher(arr, howMany) { 280 | // it doesn't always pay to be first 281 | return arr; 282 | } 283 | slasher([1, 2, 3], 2); 284 | ``` 285 | Return the remaining elements of an array after chopping off n elements from the head. 286 | 287 | Day 10 288 | ```javascript 289 | function chunk(arr, size) { 290 | // Break it up. 291 | return arr; 292 | } 293 | chunk(['a', 'b', 'c', 'd'], 2); 294 | ``` 295 | Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array. 296 | 297 | Day 9 298 | ```javascript 299 | function truncate(str, num) { 300 | // Clear out that junk in your trunk 301 | return str; 302 | } 303 | truncate('A-tisket a-tasket A green and yellow basket', 11); 304 | ``` 305 | Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a '...' ending. 306 | 307 | Day 8 308 | ```javascript 309 | function repeat(str, num) { 310 | // repeat after me 311 | return str; 312 | } 313 | repeat('abc', 3); 314 | ``` 315 | Repeat a given string (first argument) n times (second argument). Return an empty string if n is a negative number. 316 | 317 | Day 7 318 | ```javascript 319 | function end(str, target) { 320 | // "Never give up and good luck will find you.." 321 | // -- Falcor 322 | return str; 323 | } 324 | end('Bastian', 'n'); 325 | ``` 326 | Check if a string (first argument) ends with the given target string (second argument). 327 | 328 | Day 6 329 | ```javascript 330 | function largestOfFour(arr) { 331 | // You can do this! 332 | return arr; 333 | } 334 | largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]); 335 | ``` 336 | Return Largest Numbers in Arrays. 337 | 338 | Day 5 339 | ```javascript 340 | function titleCase(str) { 341 | return str; 342 | } 343 | titleCase("I'm a little tea pot") 344 | ``` 345 | Return the provided string with the first letter of each word capitalized. 346 | 347 | Day 4 348 | ```javascript 349 | function findLongestWord(str) { 350 | return str.length; 351 | } 352 | findLongestWord('The quick brown fox jumped over the lazy dog'); 353 | ``` 354 | Return the length of the longest word in the provided sentence. 355 | 356 | Day 3 357 | ```javascript 358 | function palindrome(str) { 359 | // Good luck! 360 | return true; 361 | } 362 | palindrome("eye"); 363 | ``` 364 | Return true if the given string is a palindrome. Otherwise, return false. 365 | 366 | Day 2 367 | ```javascript 368 | function factorialize(num) { 369 | return num; 370 | } 371 | factorialize(5); 372 | ``` 373 | Return the factorial of the provided integer. 374 | 375 | Day 1 376 | ```javascript 377 | function reverseString(str) { 378 | return str; 379 | } 380 | reverseString('hello'); 381 | ``` 382 | Reverse the provided string. 383 | 384 | You may need to turn the string into an array before you can reverse it. 385 | 386 | Your result must be a string. 387 | --------------------------------------------------------------------------------