Skip to content

Commit 4028eb6

Browse files
committed
Done with removing comments.
1 parent 874a034 commit 4028eb6

8 files changed

Lines changed: 16 additions & 28 deletions

Basic Algorithm Scripting/10 Bonfire Truncate a string.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,16 @@ String.slice()
1414
1515
Code by Rafael Rodriguez
1616
rafase282@gmail.com
17-
http://www.freecodecamp.com/rafase282
17+
http://www.freecodecamp.com/rafase282
1818
*/
1919

2020
function truncate(str, num) {
21-
// Create a variable to store the truncated string
2221
var truncd = '';
23-
// If the string needs to be truncated then slice and add the dots.
2422
if (str.length > num) {
25-
// num-3 because the dots we add coutns for the test.
2623
truncd = str.slice(0,num-3) + '...';
2724
return truncd;
2825
}
2926
return str;
3027
}
3128

32-
truncate('A-tisket a-tasket A green and yellow basket', 11);
29+
truncate('A-tisket a-tasket A green and yellow basket', 11);

Basic Algorithm Scripting/11 Bonfire Chunky Monkey.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Array.push()
1212
1313
Code by Rafael Rodriguez
1414
rafase282@gmail.com
15-
http://www.freecodecamp.com/rafase282
15+
http://www.freecodecamp.com/rafase282
1616
*/
1717

1818
function chunk(arr, size) {
@@ -21,7 +21,6 @@ function chunk(arr, size) {
2121
var result = [];
2222

2323
for (var a in arr) {
24-
// this is an general form
2524
if (a % size !== size - 1)
2625
temp.push(arr[a]);
2726
else {
@@ -36,4 +35,4 @@ function chunk(arr, size) {
3635
return result;
3736
}
3837

39-
chunk(['a', 'b', 'c', 'd'], 2);
38+
chunk(['a', 'b', 'c', 'd'], 2);

Basic Algorithm Scripting/12 Bonfire Slasher Flick.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ Array.slice() Array.splice()
1111
1212
Code by Rafael Rodriguez
1313
rafase282@gmail.com
14-
http://www.freecodecamp.com/rafase282
14+
http://www.freecodecamp.com/rafase282
1515
*/
1616

1717
function slasher(arr, howMany) {
18-
// Returns the arry with nth element removed from the begining.
1918
return arr.slice(howMany);
2019
}
2120

22-
slasher([1, 2, 3], 2);
21+
slasher([1, 2, 3], 2);

Basic Algorithm Scripting/13 Bonfire Mutations.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ Array.indexOf()
2121
2222
Code by Rafael Rodriguez
2323
rafase282@gmail.com
24-
http://www.freecodecamp.com/rafase282
24+
http://www.freecodecamp.com/rafase282
2525
*/
2626

2727
function mutation(arr) {
28-
// First make the arguments lowercase and arrays.
2928
var first = arr[0].toLowerCase().split('');
3029
var second = arr[1].toLowerCase().split('');
3130
var temp = 0;
32-
// Check every character and if the index is found add one
3331
for (var s in second){
3432
if (first.indexOf(second[s]) > -1) {
3533
temp+= 0;
@@ -42,4 +40,4 @@ function mutation(arr) {
4240
return false;
4341
}
4442

45-
mutation(['hello', 'hey']);
43+
mutation(['hello', 'hey']);

Basic Algorithm Scripting/14 Bonfire Falsey Bouncer.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@ Boolean Objects Array.filter()
1313
1414
Code by Rafael Rodriguez
1515
rafase282@gmail.com
16-
http://www.freecodecamp.com/rafase282
16+
http://www.freecodecamp.com/rafase282
1717
*/
1818

1919
function bouncer(arr) {
20-
// Don't show a false ID to this bouncer.
2120
function isTruthy(arg){
2221
return Boolean(arg);
2322
}
2423
var filteredArray = arr.filter(isTruthy);
2524
return filteredArray;
2625
}
2726

28-
bouncer([7, 'ate', '', false, 9]);
27+
bouncer([7, 'ate', '', false, 9]);

Basic Algorithm Scripting/15 Bonfire Where art thou.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ Global Object Object.hasOwnProperty() Object.keys()
1212
1313
Code by Rafael Rodriguez
1414
rafase282@gmail.com
15-
http://www.freecodecamp.com/rafase282
15+
http://www.freecodecamp.com/rafase282
1616
*/
1717

1818
function where(collection, source) {
1919
var arr = [];
20-
// What's in a name?
2120
for (var ob in collection) {
2221
if (collection[ob][Object.keys(source)] === source[Object.keys(source)]) {
2322
arr.push(collection[ob]);
@@ -26,4 +25,4 @@ function where(collection, source) {
2625
return arr;
2726
}
2827

29-
where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
28+
where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });

Basic Algorithm Scripting/16 Bonfire Seek and Destroy.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@ Arguments object Array.filter()
1313
1414
Code by Rafael Rodriguez
1515
rafase282@gmail.com
16-
http://www.freecodecamp.com/rafase282
16+
http://www.freecodecamp.com/rafase282
1717
*/
1818

1919
function destroyer(arr) {
20-
// Remove all the values
2120
var args = Array.prototype.slice.call(arguments);
2221
args.splice(0,1);
23-
console.log(args);
2422
return arr.filter(function(element) {
2523
return args.indexOf(element) === -1;
2624
});
2725
}
2826

29-
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
27+
destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Basic Algorithm Scripting/17 Bonfire Where do I belong.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@ Array.sort()
1515
1616
Code by Rafael Rodriguez
1717
rafase282@gmail.com
18-
http://www.freecodecamp.com/rafase282
18+
http://www.freecodecamp.com/rafase282
1919
*/
2020

2121
function where(arr, num) {
2222
arr.sort(function(a, b) {
2323
return a - b;
2424
});
25-
console.log(arr);
2625
for (var a in arr){
2726
if (arr[a] >= num)
2827
return parseInt(a);
2928
}
3029
return arr.length;
3130
}
3231

33-
where([40, 60], 50);
32+
where([40, 60], 50);

0 commit comments

Comments
 (0)