These are chat archives for FreeCodeCamp/Help

11th
Sep 2015
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:02
Hey guys
Does anyone know how I could push an element to a specific part of an array?
.push() doesn't seem to be doing the trick
Mateja Trifunovski
@Matko95
Sep 11 2015 00:02
.splice();
sexysundalo93
@sexysundalo93
Sep 11 2015 00:03
Hello World!
CamperBot
@camperbot
Sep 11 2015 00:03

welcome to FreeCodeCamp @sexysundalo93!

Mateja Trifunovski
@Matko95
Sep 11 2015 00:03
etc. .splice(2,0,'element'); where 2 is the index
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:03
Oh OK, thank you :D
CamperBot
@camperbot
Sep 11 2015 00:03
if you want to thank someone, put an @ before their name!
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:03
Thanks @Matko95
CamperBot
@camperbot
Sep 11 2015 00:03
jelanithompson sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 243 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 11 2015 00:04
@JelaniThompson just be careful with the second parameter, since it tells how many items to remove :D https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:04
Alrighty :)
sexysundalo93
@sexysundalo93
Sep 11 2015 00:04
On the HTML/CSS part of the course, Waypoint 16 seems to have a bug in it. I created an img tag with the src attribute on it, but when I run the tests, the x is still there for "create a src attribute that points to the kitten image"
Has anyone else had this issue ?
Rory Smith
@alanbuchanan
Sep 11 2015 00:05
@awesomeaniruddh i'd feel a bit guilty stealing the answer (not implying you did that)
DJ
@qualitymanifest
Sep 11 2015 00:07
@sexysundalo93 post your code or a screenshot
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:07
Question: Is this a valid statement? arr.splice(arr[i]+1, 0, num);
I'm referring to doing math in the first argument
sexysundalo93
@sexysundalo93
Sep 11 2015 00:08
blob
Aniruddh Agarwal
@anrddh
Sep 11 2015 00:09
@alanbuchanan :O I write my own code
They have some helpful tips cuz I plain suck at regex
DJ
@qualitymanifest
Sep 11 2015 00:09
@sexysundalo93 try doing it again without self-closing the tag
Mateja Trifunovski
@Matko95
Sep 11 2015 00:11
@JelaniThompson only if arr[i] is a number
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:11
Alrighty, thanks :)
CamperBot
@camperbot
Sep 11 2015 00:11
if you want to thank someone, put an @ before their name!
DJ
@qualitymanifest
Sep 11 2015 00:11
@sexysundalo93 actually, it works for me with the self-closing tag... what browser are you using?
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:11
So just to be clear, it'll put the number in front of arr[i]?
sexysundalo93
@sexysundalo93
Sep 11 2015 00:11
@qualitymanifest I'm using Google Chrome
and I tried it again and it doesn't work
without the closing tag
Mateja Trifunovski
@Matko95
Sep 11 2015 00:12
@JelaniThompson could you explain what you are trying to do?
a1rr0wh3ad
@a1rr0wh3ad
Sep 11 2015 00:12
@sexysundalo93 try using https://bit.ly/fcc-relaxing-cat not https://s3.amazonaws.com/freecodecamp/relaxing-cat.jpg
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:12
Oh, I'm working on the Where do I belong bonfire
Bonfire where do i belong
CamperBot
@camperbot
Sep 11 2015 00:12

:fire:Bonfire: Where do I belong :link:

function where(arr, num) {
  // Find my place in this sorted array.
  return num;
}

where([40, 60], 50);

Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).

more info:  bf details | bf links | hint

Rory Smith
@alanbuchanan
Sep 11 2015 00:12
@awesomeaniruddh :)
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:12
bf details
CamperBot
@camperbot
Sep 11 2015 00:12

:fire:Bonfire: Where do I belong :link:

function where(arr, num) {
  // Find my place in this sorted array.
  return num;
}

where([40, 60], 50);
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).
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:13
Pretty much that ^^^^^^
sexysundalo93
@sexysundalo93
Sep 11 2015 00:13
@a1rr0wh3ad oh now it works lulz. Thanks man! I appreciate it!
CamperBot
@camperbot
Sep 11 2015 00:13
sexysundalo93 sends brownie points to @a1rr0wh3ad :sparkles: :thumbsup: :sparkles:
:star: 303 | @a1rr0wh3ad | http://www.freecodecamp.com/a1rr0wh3ad
a1rr0wh3ad
@a1rr0wh3ad
Sep 11 2015 00:13
np
Mateja Trifunovski
@Matko95
Sep 11 2015 00:14
@JelaniThompson if you say arr[i]+1, it will give you values like 41,61
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:17
@JelaniThompson just started working on the same one . How are you doing :) ?
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:18
Still kinda confused about how to get 50 in between 40 and 60 XD
Mateja Trifunovski
@Matko95
Sep 11 2015 00:19
function convert(num) {
  var tenths=Math.floor(num/10);
  var ones=num-Math.floor(num/10)*10;
  var arr=[];
  if(tenths>0&&tenths<4)
    {
      for(var i=0;i<tenths;i++)
        {
          arr.push("X");
        }
    }
  if(ones>0&&ones<4)
    {
      for(var i=0;i<ones;i++)
        {
          arr.push("I");
        }
    }
  else if(ones===5)
    {
      arr.push("V");
    }
  else if(ones>5&&ones<9)
    {
      arr.push("V");
      for(i=0;i<ones-5;i++)
        {
          arr.push("I");
        }
    }
  else if(ones===9)
    {
      arr.push("IX")
    }
  arr=arr.join("");
 return arr;
}

convert(36);
well this passess all the tests, is it a valid solution?
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:19
heh so about where I am. I just pushed all into one array now thinking how to proceed from there :P
Mateja Trifunovski
@Matko95
Sep 11 2015 00:20
@JelaniThompson this is the task Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:21
Yeah, that's pretty much what I wanted to do
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:21
hmm i wonder why sort won't sort them in the right place
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:21
Add it to the array
and then sort them
Which sounds about right since the challenge recommends .sort() as a method to use
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:21
did that, still get 50 outside
I guess you have to use a compare function to sort it ?
Mateja Trifunovski
@Matko95
Sep 11 2015 00:21
@JelaniThompson yep that's good, just need to see it's index now
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:22
Wait, since it'll give me odd values like 41 and 61, should I just do i instead of arr[i]?
In this case, .splice(i, 0, num)
Mateja Trifunovski
@Matko95
Sep 11 2015 00:24
@Ne0nite yes, you need a compare function
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:24
@Matko95 yea figured as much, since pure .sort() does not do the job :)
Mateja Trifunovski
@Matko95
Sep 11 2015 00:24
If compareFunction is not supplied, elements are sorted by converting them to strings and comparing strings in Unicode code point order. For example, "Cherry" comes before "banana". In a numeric sort, 9 comes before 80, but because numbers are converted to strings, "80" comes before "9" in Unicode order.
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:24
kind of fuzzy on the functions yet so have to think about it
but in this case comapring strings should be right,since 50 is before 60 in unicode ? or I am missing something
Mateja Trifunovski
@Matko95
Sep 11 2015 00:26
yes, it will work for some cases
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:27
hmm i get [ [ 40, 60 ], 50 ] with a pure .sort();
rtrom
@rtrom
Sep 11 2015 00:29
I was hoping someone wouldn't mind reviewing this code I have as a solution for a bonfire; it passes, but I want to understand the "why" behind it, as I don't fully understand it myself. Anyone available?
Philip Warkentien II
@warkentien2
Sep 11 2015 00:30
@Ne0nite first thing all your values need to be in a 1D array. [40,60,50] then you can sort();
and. sort() reads as char (ascii.. where 11 < 2 since 1 < 2 )
you'll need a sort function
sort(function(a,b){ ..... });
@rtrom send it
DavidThms
@DavidThms
Sep 11 2015 00:31
Bonfire: Check for Palindromes
CamperBot
@camperbot
Sep 11 2015 00:31

:fire:Bonfire: Check for Palindromes :link:

function palindrome(str) {
  // Good luck!
  return true;
}



palindrome("eye");

Return true if the given string is a palindrome. Otherwise, return false.

more info:  bf details | bf links | hint

dormouss
@dormouss
Sep 11 2015 00:31
So I've look at the solution to the b/onfire Seek and Destroy. But I don't understand it. I think it has something to do with the inline function, but I'm not sure.
Very puzzling.
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:31
@warkentien2 Hmm i was away for a few week so I think I am a bit fuzzy on the details, but why does .push(arr, num) make it a 2D instead of a 1D ?
DavidThms
@DavidThms
Sep 11 2015 00:31
hint
CamperBot
@camperbot
Sep 11 2015 00:31
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
rtrom
@rtrom
Sep 11 2015 00:32
Ok, so this was for the Search and Destroy Bonfire:
function destroyer(arr) {
  // Remove all the values
  var args = arr.slice.call(arguments);
  args.splice(0,1);
  return arr.filter(function(element) {
    return args.indexOf(element) === -1;
  });
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
dormouss
@dormouss
Sep 11 2015 00:32
The part I'm not grokking is this:
return arr.filter(function(element) {
    return args.indexOf(element) === -1;
  });
Philip Warkentien II
@warkentien2
Sep 11 2015 00:33
@Ne0nite if you push 3. arr [1,2] => [1,2,3]
if you push an array like [3] arr [1,2] => [1,2,[3]]
Arik
@Alikdv
Sep 11 2015 00:33
hey somebody up to give short exp about thx
var array = [4,5,6,7,8];
var singleVal = 0;
// Only change code below this line.
var singleVal = array.reduce(function(previousVal, currentVal){

  return previousVal+currentVal;

});


// Only change code above this line.
(function() {return singleVal;})();
CamperBot
@camperbot
Sep 11 2015 00:33
if you want to thank someone, put an @ before their name!
dormouss
@dormouss
Sep 11 2015 00:34

@rtrom I spent a couple hours trying to figure out how to send those second (and third, and fourth, etc) values to the filter() function on the array. The first value in arguments is the array, each additional value is a value to filter on.

So here it looks like I don't even pass the 'filter values' to the array.filter() function.

Philip Warkentien II
@warkentien2
Sep 11 2015 00:34
@rtrom what don't you get?
the bonfire was to.. delete all values of first argument. that are passed as the rest of the arguments.
dormouss
@dormouss
Sep 11 2015 00:36
The first value is an array. So I think okay, I'll use array.filter( callback() ). But I don't get how to pass the 'filter' values to the callback function. The examples have a value hardcoded.
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:37
@warkentien2 erm so convert the second argument into a string and then push it in ? Still kind of fuzzy . Basically that's what I have now :
function where(arr, num) {
  var newArray = []
  newArray.push(arr, num);
  newArray.sort();
  console.log (newArray);
  return num;
}

where([40, 60], 50);
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:37
@warkentien2 Hey, is this a step in the right direction towards the advice you gave?
function where(arr, num) {
  // Find my place in this sorted array.
  for (var i = 0; i < arr.length; i++) {
    arr = [];

    if(num > arr[i] || num < arr[i]) {
      arr[i].push(num);
      arr.sort();
    }

    else {
      break;
    }

  }
  return num;
}

where([40, 60], 50);
a1rr0wh3ad
@a1rr0wh3ad
Sep 11 2015 00:37
@dormouss the method filter goes through each element of the array. it automatically does the loop for you. the parameter element represents the current element it is processing.
dormouss
@dormouss
Sep 11 2015 00:39
@a1rr0wh3ad Right. But whenever I try and pass the 'filter' values to the callback function, it doesn't work. I'm ginning up some code as an example.
a1rr0wh3ad
@a1rr0wh3ad
Sep 11 2015 00:39
@dormouss how are you doing that? can you post your code?
dormouss
@dormouss
Sep 11 2015 00:40
Yes. I have lots of comments and console.log's so I'm cleaning it up before I post it.
Philip Warkentien II
@warkentien2
Sep 11 2015 00:40

@Ne0nite @JelaniThompson I got mixed up with another bonfire.
this is simpler..

all it wants to know is.. at what index should you orderly place given value

a1rr0wh3ad
@a1rr0wh3ad
Sep 11 2015 00:40
ok
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:40
Yeah, on paper it sounds easy. push to an array and then sort
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:40
:)
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:40
For some reason, it's the actual execution that's tripping me up
lol
Philip Warkentien II
@warkentien2
Sep 11 2015 00:41
@Ne0nite @JelaniThompson just loop the array once, and until value > array value at given index keep going
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:41
that blasted logic :P
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 00:41
Does anyone have any idea why my Waypoint progress would be accurate on my phone, but when I login to a computer, it shows no progress completed?
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:41
@warkentien2 thanks for the tips and sorry to bother :D
CamperBot
@camperbot
Sep 11 2015 00:41
ne0nite sends brownie points to @warkentien2 :sparkles: :thumbsup: :sparkles:
:star: 283 | @warkentien2 | http://www.freecodecamp.com/warkentien2
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:41
@warkentien2 Thanks
Philip Warkentien II
@warkentien2
Sep 11 2015 00:42
@Ne0nite @JelaniThompson, no problem anytime!
dormouss
@dormouss
Sep 11 2015 00:43
@a1rr0wh3ad Here is my psuedocode:
function filtering(valueToFilterOUt) 
{
    if (SOME KIND OF MAGIC TO ACCESS ARRAY HERE) === valueToFilterOut)
        return true; 
}

function destroyer(arr) { 
    // Remove all the values

    var inputs = Array.prototype.slice.call(arguments);

    var seekArray = inputs[0];


    var otherinput = arguments;   
//console.log(typeof otherinput);

    var arrgh = seekArray.filter(filtering(VALUE TO FILTER));

    return arrrgh;
}
The 'VALUE TO FILTER' I will extract from the remaining array, probably with a for loop.
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:44
@IgnisCerebrum try reloging to FCC maybe or clearing cache ?
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:45
@Ne0nite If both of us are still stuck later, up for some pair programming?
DJ
@qualitymanifest
Sep 11 2015 00:45
@dormouss some kind of magic = arguments
Philip Warkentien II
@warkentien2
Sep 11 2015 00:45
@rtrom back to you.
I access a variable arguments through. note that arguments was never declared (it just knows) <- should have a better answer
function foo() {
  for (var i = 0; i < arguments.length; i++) {
    alert(arguments[i]);
  }
}
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:45
@JelaniThompson sure but I am kind of hobby programming at this moment since I am in middle of my wine bottle :P
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:46
lol okie dokes XD
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:46
so you will probably get there way faster than me :D
Robert Sun
@sunwrobert
Sep 11 2015 00:46
Hi guys, I'm trying to do the weather zipline, and I'm trying to get data from this weather api with this endpoint: api.openweathermap.org/data/2.5/weather?q=atlanta, but when I do $.getJSON with this url it returns me a 404 in codepen, anyone have any idea why?
Philip Warkentien II
@warkentien2
Sep 11 2015 00:47
@sunwrobert ppl should help you faster at the HelpZiplines chat room. I'm stuck in the same zipline
dormouss
@dormouss
Sep 11 2015 00:48
@qualitymanifest It seems like the 'arguments' in the callback function (filtering()) is same as the 'arguments' in the destroyer() function.
Jesse
@jctm30
Sep 11 2015 00:48
function mutation(arr) {
  var indices = [];
  var firstArray = arr[0]; // var firstArray = 'hello'
  var secondArray = arr[1]; // var secondArray = 'hey'
  var element = secondArray.split(''); // var element = ['h', 'e', 'y']
  var newElement = element.toString();
  var idx = firstArray.indexOf(newElement);
  while (idx != -1) {
      indices.push(idx);
      idx = array.indexOf(newElement, idx + 1);
  }
  if (indices.length >= secondArray.length) {
      return true;
      }
      else {
      return false;
      }
  return arr;
}
mutation(['hello', 'hey']);
hey guys, im doing the mutation bon fire. what am i missing here?? any help is greatly appreciated!!
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:48
@JelaniThompson btw just skimmed over your code. wpn't your arr be reset to [] on every loop ?
won't*
dormouss
@dormouss
Sep 11 2015 00:49
At this point I think I'm going to skip the filter() call altogether, just brute force it with a for loop. I want to write code that I can call my own to pass the unit tests. :smile:
Thanks anyways everyone for the help.
CamperBot
@camperbot
Sep 11 2015 00:50
if you want to thank someone, put an @ before their name!
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:50
dorm you want the filter code for review for later ?
@dormouss
dormouss
@dormouss
Sep 11 2015 00:51
@Ne0nite I'm not sure what you mean.
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 00:51
@Ne0nite I've relogged in. I don't know how to clear a cache on my phone.
dormouss
@dormouss
Sep 11 2015 00:52
@Ne0nite @qualitymanifest @a1rr0wh3ad Thanks for your help tonight.
CamperBot
@camperbot
Sep 11 2015 00:52
dormouss sends brownie points to @ne0nite and @qualitymanifest and @a1rr0wh3ad :sparkles: :thumbsup: :sparkles:
:star: 131 | @ne0nite | http://www.freecodecamp.com/ne0nite
:star: 193 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
:star: 304 | @a1rr0wh3ad | http://www.freecodecamp.com/a1rr0wh3ad
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:52
@dormouss oh nvm I thought you are at seek and destroy and had problems with the filter logic :)
Philip Warkentien II
@warkentien2
Sep 11 2015 00:52
@jctm30 your doing a indexOf("string") instead of "s" <- char.
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:52
@Ne0nite Oh true, thanks :D
CamperBot
@camperbot
Sep 11 2015 00:52
jelanithompson sends brownie points to @ne0nite :sparkles: :thumbsup: :sparkles:
:star: 132 | @ne0nite | http://www.freecodecamp.com/ne0nite
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:52
@JelaniThompson your welcome :)
dormouss
@dormouss
Sep 11 2015 00:53
@Ne0nite Yeah, I'm just not grokking how to pass values through filter(). I looked at the Seek and Destroy solution and I still don't get it.
Philip Warkentien II
@warkentien2
Sep 11 2015 00:53
@jctm30 then you call array.indexOf when you never declared var array. I'm lost.
Jelani Thompson
@JelaniThompson
Sep 11 2015 00:54
bonfire where do i belong
CamperBot
@camperbot
Sep 11 2015 00:54

:fire:Bonfire: Where do I belong :link:

function where(arr, num) {
  // Find my place in this sorted array.
  return num;
}

where([40, 60], 50);

Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).

more info:  bf details | bf links | hint

Jelani Thompson
@JelaniThompson
Sep 11 2015 00:54
hint
CamperBot
@camperbot
Sep 11 2015 00:54
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Philip Warkentien II
@warkentien2
Sep 11 2015 00:55
@dormouss you mean... arr.filter(function(value){ return (value test); }); // if true arr will keep value, if false it's filtered.
value test = a test like.. arr1.indexOf(value) >= 0;
dormouss
@dormouss
Sep 11 2015 00:55
@Ne0nite I get that there is an implied value that's the element of the array currently being filtered. But I don't see how to pass a 'comparison value' to do some filtering with it. The examples in the MDN use hard-coded values.
Tom Pyszczuk
@Ne0nite
Sep 11 2015 00:56
@dormouss well I did this one some time ago so I can show you the code if you want for review :)
dormouss
@dormouss
Sep 11 2015 00:56
@warkentien2 Yeah, when I do that (or something like that?) I get TypeError: undefined is not a function
@warkentien2 Also, is that a lambda or something you're using? Some kind of un-named function?
Philip Warkentien II
@warkentien2
Sep 11 2015 00:57
@dormouss send me your function I'll fix it for you. here or P.M. must be some boring notation issue
@dormouss yes. an unnamed function. but doens't have to be;
Mateja Trifunovski
@Matko95
Sep 11 2015 01:00
is value of 'j' in UNICODE 60A?
max77p
@max77p
Sep 11 2015 01:00

can someone help me understand this ```js
function guessNumber(number) {
// Prompt the user for a number
guess = prompt("Guess a number between 1 and 100");

// Convert their guess to a number using +
guess = +guess;
```

is guess=+guess; same as saying var guess= guess?
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:01
Bleh
max77p
@max77p
Sep 11 2015 01:01
ignore what the rest of the code does, just trying to understand this part
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:01
How many hours is it normal to be stuck on a simple error like this? XD
It took me like 6 to solve the last bonfire @_@
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:02
@JelaniThompson a lot sometimes , untill You get it I guess :)
max77p
@max77p
Sep 11 2015 01:02
@JelaniThompson as many as you need to understand the problem
only way to learn
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:02
ah
max77p
@max77p
Sep 11 2015 01:03
guys any idea on my question?
a1rr0wh3ad
@a1rr0wh3ad
Sep 11 2015 01:03
@dormouss if i'm understanding correctly, the 'comparison value' is meant to be hard coded. and if you ever need to access the original array, you can use the third parameter in the callback.
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:03
@JelaniThompson I still can't figure out why it pushes me the second argument as a seperate array :P
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:04
Lol, it burns even more that it's literally right before the front end projects
Which I was excited to start
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:05
@JelaniThompson lol I feel ya , I have the same thing :)
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:05
XD
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:06
bleh how do you push the second argument to the same array instead of it making it a 2d array :/ ... bleh thats what I get for taking almost a week of from FCC :/
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:08
Try me, I was gone for 2 LLOL
Not sure if I should leave this for tomorrow or stay up REALLY late
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:09
lol :D
well its 3 am here but now this is ambition for me I guess :P
and I got my wine still half finished :P
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:10
LOL
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:12
How does one copy the screen so one can get help on a Waypoint?
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:12
@JelaniThompson didn't you know :smile:
ballmer_peak.png
@IgnisCerebrum either do a print screen or copy paste the code
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:14
rofl
Mateja Trifunovski
@Matko95
Sep 11 2015 01:14
@IgnisCerebrum explain formatting
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:14
@JelaniThompson hey its scientifically proven :P really check it out :D
Mateja Trifunovski
@Matko95
Sep 11 2015 01:14
explain code formatting
CamperBot
@camperbot
Sep 11 2015 01:14

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

```js ⇦ Type 3 backticks, then type js or html and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Mateja Trifunovski
@Matko95
Sep 11 2015 01:14
@IgnisCerebrum just post your code
@JelaniThompson the ziplines will give you far more problems then the bonfires :)
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:17
@Matko95 Yeah, but at least you're creating something xD
From what I've heard, people learn a whole lot more through projects than individual lessons. They just tend to remember more lel
Mateja Trifunovski
@Matko95
Sep 11 2015 01:17
@JelaniThompson True, but the idea is that you learn something :) you will be using some of those algorithms in your projects
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:17
Oh lol
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:21
yay managed to sort the bloody thing :)
now hmm well yea what now ... :P
Josh
@obscureether
Sep 11 2015 01:22
hey can some one tell me what is wrong with this?==>
<div class="row">
     <div class="col=xs-7">
    <input type="text" class="form-control" placeholder="cat photo URL" required>
    </div>
    <div class="col-xs-5">
    <button type="submit" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Submit</button>
    </div>
    </div>
  </form>
</div>
says that i am missing....Nest your form text input in a div with the class col-xs-7.
Mateja Trifunovski
@Matko95
Sep 11 2015 01:24
@obscureether you made a typo <div class="col=xs-7"> should be <div class="col-xs-7">
BabyKosh
@badbabykosh
Sep 11 2015 01:24
greetings programs...for zipline quotemachine...when I test getting the data in my browser I get ERROR: "XMLHttpRequest cannot load http://api.forismatic.com/api/1.0/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access."
Mateja Trifunovski
@Matko95
Sep 11 2015 01:24
@badbabykosh as far as i understood, you need a call back when that happens
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:25
I don't understand how to find the code.
Josh
@obscureether
Sep 11 2015 01:25
@badbabykosh thanks...!
CamperBot
@camperbot
Sep 11 2015 01:25
obscureether sends brownie points to @badbabykosh :sparkles: :thumbsup: :sparkles:
:star: 258 | @badbabykosh | http://www.freecodecamp.com/badbabykosh
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:25
@IgnisCerebrum what do you mean by find the code ?
Mateja Trifunovski
@Matko95
Sep 11 2015 01:26
@badbabykosh or forcing the JSONP call
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:26
@Ne0nite You said to copy and paste the code. What code?
Mateja Trifunovski
@Matko95
Sep 11 2015 01:26
@badbabykosh I know one of those 2 things sorted it for me :D
@IgnisCerebrum what do you need help with?
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:27
@IgnisCerebrum Well you said you had some problems with some code.. so I said copy the code or paste the screen grab of the code :D
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:27
@Matko95 I want to take a picture of the black box to post here to show what I have done, so I can get help with what I am doing wrong.
Mateja Trifunovski
@Matko95
Sep 11 2015 01:27
@IgnisCerebrum copy the text from the black box here
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:28
@IgnisCerebrum copy the text (select it and copy) or do alt + prt scr for a print screen
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:28
@Ne0nite Sorry, I thought you were saying there is a code somewhere that will show the entirety of what I am working on. :P
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:28
:D
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:28

<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

.smaller-image {
width: 100px;
}

.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid; }
</style>

<h2 class="red-text">CatPhotoApp</h2>

<img class="smaller-image" >https://bit.ly/fc -relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

SEE?? There is no black box.
I knew that didn't make sense.
Mateja Trifunovski
@Matko95
Sep 11 2015 01:29
explain formatting
CamperBot
@camperbot
Sep 11 2015 01:29

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

```js ⇦ Type 3 backticks, then type js or html and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Mateja Trifunovski
@Matko95
Sep 11 2015 01:30
@IgnisCerebrum use the guide above
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:30
@IgnisCerebrum for future reference do this before you paste a code .. type "``" (three) then shift + press enter . Then copy the code then press shift + enter ag
Mateja Trifunovski
@Matko95
Sep 11 2015 01:31
bf sorted union
CamperBot
@camperbot
Sep 11 2015 01:31

:fire:Bonfire: Sorted Union :link:

function unite(arr1, arr2, arr3) {
  return arr1;
}

unite([1, 2, 3], [5, 2, 1, 4], [2, 1]);

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.

more info:  bf details | bf links | hint

Mateja Trifunovski
@Matko95
Sep 11 2015 01:31
hint
CamperBot
@camperbot
Sep 11 2015 01:31
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:31
@JelaniThompson did you manage to figure it out ? I managed to push all the arguments into one array and sort them .. but kind of stuck now :)
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:31
Still stumped XD
Hopefully I can get it soon though haha
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:33
Thanks. Some of us are starting from nothing, clearly.
CamperBot
@camperbot
Sep 11 2015 01:33
if you want to thank someone, put an @ before their name!
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:33
did you go with the approach of making a new array and pushing all arguments and then sorting them , after that magic happens way ? or some other :) ?
@IgnisCerebrum no worries , thats the place to ask questions and learn :) don't b shy :D
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:33
So, I need to "Create a class called thick-green-border that puts a 10-pixel-wide green border with a style of solid around an HTML element, and apply that class to your cat photo."
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:34
@IgnisCerebrum I ask a lot of stupid questions and those guys are usually really nice :P
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:34
@Ne0nite Thanks. I know psychology, not computers. I don't enjoy ignorance. :P Keeps you humble, right?
CamperBot
@camperbot
Sep 11 2015 01:34
igniscerebrum sends brownie points to @ne0nite :sparkles: :thumbsup: :sparkles:
:star: 133 | @ne0nite | http://www.freecodecamp.com/ne0nite
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:35
@IgnisCerebrum :D meh its just another language to learn ;) which challenge are you at ?
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:35
@Ne0nite Waypoint: Add borders around your element
Jelani Thompson
@JelaniThompson
Sep 11 2015 01:36
@Ne0nite Nope, I'll try that though!
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:37
@Ne0nite I believe I created the class correctly. I now can't figure out how to make it work on the HTML element.
Mateja Trifunovski
@Matko95
Sep 11 2015 01:38
@IgnisCerebrum in this line <img class="smaller-image" >https://bit.ly/fc -relaxing-cat">
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:38
@IgnisCerebrum meh I have my old code there which is different (and which should be changed after the beta ..nvm). but it basically tells you in the description. just copy paste their example and change the values in class
Mateja Trifunovski
@Matko95
Sep 11 2015 01:38
add another class class="smaller-image thick-green-border"
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:38
@Matko95 I tried that, but I must have missed something. .
DJ
@qualitymanifest
Sep 11 2015 01:39
@IgnisCerebrum paste the line where you tried it
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:39
@JelaniThompson let me know when you get there .. I kind of stuck at what to do next (probably because I am more chatting then working thou :P )
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:39
Thanks @Matko95 !
CamperBot
@camperbot
Sep 11 2015 01:39
igniscerebrum sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 250 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 11 2015 01:39
@IgnisCerebrum does it work?
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:40
@Matko95 Yes. I had tried to create a separate class= designation. It didn't say to simply put a space and put it next to the first one.
Thanks @Ne0nite :)
CamperBot
@camperbot
Sep 11 2015 01:41
igniscerebrum sends brownie points to @ne0nite :sparkles: :thumbsup: :sparkles:
:warning: igniscerebrum already gave ne0nite points
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:41
@IgnisCerebrum You are Welcome, happy to help :)
Mateja Trifunovski
@Matko95
Sep 11 2015 01:41
@IgnisCerebrum Yeah, they didn't specify how do you add several classes :D I had that problem too, but feel free to google search or ask someone if you are uncertain about syntax issues
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:42
@Matko95 btw just curious might I ask where You are from :) ?
Mateja Trifunovski
@Matko95
Sep 11 2015 01:43
@Ne0nite Serbia :) you?
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:43
@Matko95 What are the punctuation mark things called in coding? I'm assuming they aren't still called punctuation marks, e.g. ;, {, etc.
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:43
@Matko95 ahh okies, Poland here. Just curious since your nick translates into "mother" in my language :D
Mateja Trifunovski
@Matko95
Sep 11 2015 01:43
@Ne0nite Yeah, polish people love my nickname :D
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:43
:D
Mateja Trifunovski
@Matko95
Sep 11 2015 01:44
@IgnisCerebrum I am no expert coder, but so far i haven't heard for a special name.
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:45
I'm really enjoying learning how to code... except for when I get stuck. Then I want to punch something because I'm so irritated. :P
Mateja Trifunovski
@Matko95
Sep 11 2015 01:46
It feels a lot better when you get unstuck though :D
IgnisCerebrum
@IgnisCerebrum
Sep 11 2015 01:47
Yes, then I feel brilliant for the next five minutes, until I'm confused again. :D
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:47
@IgnisCerebrum dont worry about it. You will get stuck A LOT .. and let me tell ya , sometimes it will be uber frustrating .. but thats coding for ya .. Figuring out the code thou . that's a great moment :D
@IgnisCerebrum I am stuck on something for a better part of this day :)
Mateja Trifunovski
@Matko95
Sep 11 2015 01:49
@Ne0nite did you sort it out?
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:50
@Matko95 the last one yea, stuck at the last basic bonfire " Where do I belong"
I managed to push all arguments into one array and sort them
and here is where I am stuck , cant figure out how to check the lowest index
Mateja Trifunovski
@Matko95
Sep 11 2015 01:51
@Ne0nite Want a hint?
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:52
@Matko95 hmm yea I guess. I know I have to make some for loop to check the value of the arguments (i think) but cant figure out the logic
function where(arr, num) {
  var oldArray = arr;
  var newArray = oldArray.concat(num);
  newArray.sort();
  console.log(newArray);
  for (var i = 0; i < newArray.length; i++) {

  }
}

where([40, 60], 50);
thats what I have :D
Jacob Boykin
@jacobboykin
Sep 11 2015 01:53
bf seek and destroy
CamperBot
@camperbot
Sep 11 2015 01:53

:fire:Bonfire: Seek and Destroy :link:

function destroyer(arr) {
  // Remove all the values
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

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.

more info:  bf details | bf links | hint

Mateja Trifunovski
@Matko95
Sep 11 2015 01:53
@Ne0nite
well you started nicely, try something like
for()
{
  if()
{
break;
}
}
Jacob Boykin
@jacobboykin
Sep 11 2015 01:53
hint
CamperBot
@camperbot
Sep 11 2015 01:53
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:53
@Matko95 yea I figured its some kind of for loop :)
Mateja Trifunovski
@Matko95
Sep 11 2015 01:54
@Ne0nite btw.. break; exits the loop, when condition is true
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:54
I love for loops btw .I think I did almost all challenges/bonfires with one :D even when they were not really needed :P
@Matko95 hmm thanks for a hidden hint there I think :D
CamperBot
@camperbot
Sep 11 2015 01:55
ne0nite sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 251 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 11 2015 01:55
@Ne0nite tinker with it, and get back if you still can't make it :)
Tom Pyszczuk
@Ne0nite
Sep 11 2015 01:56
@Matko95 will do .. lol I see it already, will go to bed at 5am if I'm lucky .. brb need to go to shop to get some % fuel for myself :P
BabyKosh
@badbabykosh
Sep 11 2015 01:59
Hey crew...can someone take a peek at my code for RandomQuote Generator and just tell me if I am thinking correctly? Am I going in the right direction?....http://codepen.io/badbabykosh/pen/gaaxRR
gabazine
@gabazine
Sep 11 2015 01:59
Hi, can someone tell me why the first code passes but not the second
function isRemoved(val){

      /*difference is here*/     if(val !== destroyer.arguments[i])
         return val;   

  }

   function destroyer(arr) {
      for(i = arguments.length; i>0; i--){
        arr = arguments[0].filter(isRemoved);
      }
  // Remove all the valuesd
     return arr;
   }



destroyer([1, 2, 3, 1, 2, 3], 2, 3);
function isRemoved(val){

   /*difference is here*/        if(val !== arguments[i])
         return val;   

  }

   function destroyer(arr) {
      for(i = arguments.length; i>0; i--){
        arr = arguments[0].filter(isRemoved);
      }
  // Remove all the valuesd
     return arr;
   }



destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Mateja Trifunovski
@Matko95
Sep 11 2015 02:03
@gabazine try putting arr = arguments[i].filter(isRemoved);
Jon
@guavajellyf1sh
Sep 11 2015 02:05
$($('.slot')[0]).html('<img src = "' + images [slotOne-1] + '">');
$($('.slot')[1]).html('<img src = "' + images [slotTwo-1] + '">');
$($('.slot')[2]).html('<img src = "' + images [slotThree-1] + '">');
Challenge still fails though code should be correct
gabazine
@gabazine
Sep 11 2015 02:05
This message was deleted
Moisés Man
@moigithub
Sep 11 2015 02:05
any1 knows how to merge chained promises results on angular ?? im using $q.all() and services
trying to redo twitchTV on angular this time.. (first time did with jquery)
Jon
@guavajellyf1sh
Sep 11 2015 02:06
Read through other peoples posts and found the same thing but it should've been corrected.
Moisés Man
@moigithub
Sep 11 2015 02:11
@guavajellyf1sh remove extra spaces.. test dont like it.. it check IF matches the EXACT string/code
u have imagesspace[slotOne-1 ...
would be better if u copy /paste the code they provide (left side) .. and modify only the needed part.. without adding extra spaces
Miguel Bertaud
@miguelbertaud
Sep 11 2015 02:18
blob
i need help what is wrong with my html
blob
blob
Harvey
@harvey56
Sep 11 2015 02:19
hi! would anyone have any resource to point me to about how to use $.get to interact with an API ? i can't understand how that works, and the documentation on jquery website does not help me.
Mateja Trifunovski
@Matko95
Sep 11 2015 02:20
@miguelbertaud try adding style="background-color:green;" to the form
@harvey56 https://www.youtube.com/watch?v=fEYx8dQr_cQ this kinda helped me
Harvey
@harvey56
Sep 11 2015 02:22
@Matko95 thanks ! gonna check that
CamperBot
@camperbot
Sep 11 2015 02:22
harvey56 sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 252 | @matko95 | http://www.freecodecamp.com/matko95
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:22
@Matko95 back from shop and I need some explanation :) Why does the indexOf register 3 hits on the array ? My idea is to go over every [i] in array and if the indexOf finds (num) then return the index number (not sure how to return the number of index instead of value but thats skipping ahead ;) )
function where(arr, num) {
  var oldArray = arr;
  var newArray = oldArray.concat(num);
  newArray.sort();
  console.log(newArray);
  for (var i = 0; i < newArray.length; i++) {
      if(newArray.indexOf(num) >= 0 ) {
        console.log("yes");
      }
  }
}

where([40, 60], 50);
Mateja Trifunovski
@Matko95
Sep 11 2015 02:23
let me check
Andre Parsons
@Andrparsons
Sep 11 2015 02:25
Hi Guys, did the order of the challenges get rearranged or something? I just logged on and its looks like a skipped some but I'm pretty sure I didn't last night
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:25
@Andrparsons yes they did some rearanging again :)
Andre Parsons
@Andrparsons
Sep 11 2015 02:26
Oh ok no worries then, thanks!
CamperBot
@camperbot
Sep 11 2015 02:26
if you want to thank someone, put an @ before their name!
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:28
oh btw to cheer up the frustrated :)
2245445147_ff54c5997d.jpg
Mateja Trifunovski
@Matko95
Sep 11 2015 02:31
@Ne0nite The .indexOf remains a mystery to me, but you can try something like this
function where(arr, num) {
  var oldArray = arr;
  var newArray = oldArray.concat(num);
  var compare= function(num1,num2)
  {
    return num1-num2;
  }
  newArray.sort(compare);
  console.log(newArray);
  for (var i = 0; i < newArray.length; i++) {
      if(newArray[i]=== num ) 
      {
        console.log("yes");
      }
    else
      {
        console.log("no");
      }
  }
  return newArray;
}

where([40, 60], 50);
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:32
@Matko95 aww you did a function on me there ... trying to avoid those :P but will try to go over it and figure it out :) Thanks
CamperBot
@camperbot
Sep 11 2015 02:32
ne0nite sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:warning: ne0nite already gave matko95 points
Mateja Trifunovski
@Matko95
Sep 11 2015 02:33
@Ne0nite You can see that in the MDN, it's used for comparing numbers, from smallest to biggest
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:33
@Matko95 erm but you used the function to sort the array.. I did that without it and it worked fine ...
Mateja Trifunovski
@Matko95
Sep 11 2015 02:34
it works for the first example, but not for the others
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:34
ah ... didn't look at the other examples :)
Mateja Trifunovski
@Matko95
Sep 11 2015 02:34
btw.. actually you don't need a for loop
return newArray.indexOf(num); works pretty well :D
Jelani Thompson
@JelaniThompson
Sep 11 2015 02:35
Yep, starting to get mentally exhausted LOL, time for a break haha
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:35
@Matko95 hmm will go over it then :) thanks
CamperBot
@camperbot
Sep 11 2015 02:35
ne0nite sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:warning: ne0nite already gave matko95 points
Mateja Trifunovski
@Matko95
Sep 11 2015 02:36
@Ne0nite np :) sorry if i spoiled something for you
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:36
@JelaniThompson do quit the force is strong with that one :D
don't*
:D
@Matko95 no worries , you save me some wall head bashing :D
Mateja Trifunovski
@Matko95
Sep 11 2015 02:36
Anyone here familiar with HTML entities?
Jelani Thompson
@JelaniThompson
Sep 11 2015 02:37
lol
Branden
@4everyoungz
Sep 11 2015 02:37
help: Waypoint Make Object Properties Privat
CamperBot
@camperbot
Sep 11 2015 02:37
no wiki entry for: waypoint make object properties privat
:pencil: click here to create one now!after creating your page type update to reload it here
Branden
@4everyoungz
Sep 11 2015 02:37
gr
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:39
btw gang since our music channels is pretty dead let me remind You that we have our own channel where you can stream music for our coding pleasure on https://plug.dj/freecodecamp
Jesse
@jctm30
Sep 11 2015 02:40
if (finalArr.indexOf(-1) > -1)
hi, can someone help explain what finalArr.indexOf(-1) means?
Branden
@4everyoungz
Sep 11 2015 02:41
Anyone good with Objects? I'm stuck on the making properties private
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:41
Woot this small adjustment cleared the bonfire, thank You @Matko95 ... And I understand the code so no worries there :D
CamperBot
@camperbot
Sep 11 2015 02:41
ne0nite sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:warning: ne0nite already gave matko95 points
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:42
still stumped why the idexOf didnt work thou :)
my first zipline .... looks scary :P
Mateja Trifunovski
@Matko95
Sep 11 2015 02:43
same :D
Jimmy
@Nerdherdx
Sep 11 2015 02:43
can someone help me with bonfire:confirm the ending?
CamperBot
@camperbot
Sep 11 2015 02:43
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Mateja Trifunovski
@Matko95
Sep 11 2015 02:43
it definently is, but it's the most fun
Jimmy
@Nerdherdx
Sep 11 2015 02:43
bonfire confirm the ending
CamperBot
@camperbot
Sep 11 2015 02:43

:fire:Bonfire: Confirm the Ending :link:

function end(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  return str;
}

end('Bastian', 'n');

Check if a string (first argument) ends with the given target string (second argument).

more info:  bf details | bf links | hint

Jimmy
@Nerdherdx
Sep 11 2015 02:43
hint
CamperBot
@camperbot
Sep 11 2015 02:43
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Tom Pyszczuk
@Ne0nite
Sep 11 2015 02:46
Well that is a great time to get some sleep then :) @Matko95 Thanks again for all the help, let me know if you need anything :) @JelaniThompson Good luck on that one young padawan :P let me know if you want to pair sometime .. :) Have a good night/day to everybody
CamperBot
@camperbot
Sep 11 2015 02:46
ne0nite sends brownie points to @matko95 and @jelanithompson :sparkles: :thumbsup: :sparkles:
:warning: ne0nite already gave matko95 points
:warning: could not find receiver for jelanithompson
Branden
@4everyoungz
Sep 11 2015 02:46
hint
CamperBot
@camperbot
Sep 11 2015 02:46
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Mateja Trifunovski
@Matko95
Sep 11 2015 02:47
good night :) @Ne0nite
Branden
@4everyoungz
Sep 11 2015 02:49
ugh object :(
Moisés Man
@moigithub
Sep 11 2015 02:54
http://codepen.io/MMan/full/Kddqpg/
redid twitchTV on angular :)
Jose M Viloria
@josevill
Sep 11 2015 03:11
function where(arr, num){
  // Find my place in this sorted array.
  arr = arr.sort();
  for(i=0; i < arr.length; i++){
    if(num <= arr[i]){
      return i;
    }
  }
}

where([2, 5, 10], 15); // This test returns undefined, why? JS elders
Hans van Riet
@hansinla
Sep 11 2015 03:32
@moigithub nice job!
srirussel
@srirussel
Sep 11 2015 03:38
having problems this
with this
//Add the property "engines" to myCar, and make it a number.
myCar["engine"] = 1;
Arnav Kumar
@Arnavk05
Sep 11 2015 03:43
Waypoint: Make Instances of Objects with a Constructor Function
Aniruddh Agarwal
@anrddh
Sep 11 2015 03:43
engines
your code is setting engine to one
@srirussel ^
you have to set engines to one or whatever value you'd like :)
Arnav Kumar
@Arnavk05
Sep 11 2015 03:43
It is not working
How do I do that?
Aniruddh Agarwal
@anrddh
Sep 11 2015 03:43
@Arnavk05 what's not working?
Can you post your current code and link to the waypoint?
Jose M Viloria
@josevill
Sep 11 2015 03:45
@srirussel You're supposed to create a new property named: engines
srirussel
@srirussel
Sep 11 2015 03:45
yea its engines my bad
Arnav Kumar
@Arnavk05
Sep 11 2015 03:45
Oh nevermind, i spelled "engines wrong"
srirussel
@srirussel
Sep 11 2015 03:45
ahaha didnt see the "S" there
Aniruddh Agarwal
@anrddh
Sep 11 2015 03:45
So the issue is fixed?
Arnav Kumar
@Arnavk05
Sep 11 2015 03:46
Yes.
Aniruddh Agarwal
@anrddh
Sep 11 2015 03:46
Great.
Arnav Kumar
@Arnavk05
Sep 11 2015 03:46
Thank you
CamperBot
@camperbot
Sep 11 2015 03:46
if you want to thank someone, put an @ before their name!
srirussel
@srirussel
Sep 11 2015 03:49
THANKS EVERYONE
CamperBot
@camperbot
Sep 11 2015 03:49
if you want to thank someone, put an @ before their name!
Arnav Kumar
@Arnavk05
Sep 11 2015 03:59
thank you
CamperBot
@camperbot
Sep 11 2015 03:59
if you want to thank someone, put an @ before their name!
Arnav Kumar
@Arnavk05
Sep 11 2015 03:59
@camperbot thank you
CamperBot
@camperbot
Sep 11 2015 03:59
arnavk05 sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 205 | @camperbot | http://www.freecodecamp.com/camperbot
sayi
@osayi
Sep 11 2015 04:19
anyone there?
Sylwia M. Bialczak
@ArgonCode
Sep 11 2015 04:20
@osayi yes on my part
sayi
@osayi
Sep 11 2015 04:23
any idea how to import google fonts?
Sylwia M. Bialczak
@ArgonCode
Sep 11 2015 04:24
yes, you have to use link tag
when you are iin google font website, they actually give you the whole data to use
what font do you want to use?
go to google fonts: https://www.google.com/fonts
click the font, than in the lower corner, there is an icon for quick use
sayi
@osayi
Sep 11 2015 04:26
yeah but where do I place it in the code
Sylwia M. Bialczak
@ArgonCode
Sep 11 2015 04:26
in the head of html
sayi
@osayi
Sep 11 2015 04:26
like do i place the link within the element I'm using?
Sylwia M. Bialczak
@ArgonCode
Sep 11 2015 04:26
no, if you want to use it on a certain element, you will have to specify this in css
you however give the access to the font by linking it in html
I think in FCC you just place it on top of the sandbox area, it should work
Bill
@kirah1314
Sep 11 2015 04:29
@osayi copy the link from google and paste it between <head> and </head> on the HTML side then apply font-family: font name in the CSS side
sayi
@osayi
Sep 11 2015 04:32
thanks guys turns out I had a bug
CamperBot
@camperbot
Sep 11 2015 04:32
if you want to thank someone, put an @ before their name!
sayi
@osayi
Sep 11 2015 04:33
thanks @ArgonCode @kirah1314
CamperBot
@camperbot
Sep 11 2015 04:33
osayi sends brownie points to @argoncode and @kirah1314 :sparkles: :thumbsup: :sparkles:
:star: 224 | @argoncode | http://www.freecodecamp.com/argoncode
:star: 234 | @kirah1314 | http://www.freecodecamp.com/kirah1314
Sylwia M. Bialczak
@ArgonCode
Sep 11 2015 04:33
:-) yeah, there's always a bug, this is what it is all about debugging
sayi
@osayi
Sep 11 2015 04:45
haha very true
Jonathan
@jcadle
Sep 11 2015 05:30
Good evening everyone
I've run into a slight problem with the "where to I belong" bonfire. My code works for some examples, but not others, and I'm not sure why.
Wastinik
@Wastinik
Sep 11 2015 05:31
whats your code?
@jcadle
you should look at what's different in the examples that don't work... there's probably some small bit missing in your code
Jonathan
@jcadle
Sep 11 2015 05:36
ah, I just caught it
it wasn't sorting numerically, it was sorting with the default, which is ascii(?)
Randy Goldsmith
@Dueldrawer8
Sep 11 2015 06:36
// start with some initial balance
var bankAccount = {
    total: 0,
    add: function(addAmount){
         return this.total += addAmount;
    },
    subtract: function(subtractAmount){
        return this.total -= subtractAmount;

    }
};

// be able to check my balance
console.log('Your current balance is ' +bankAccount.total);

// deposit some money.. update balance
var addAmount = console.log(prompt('How much money would you like to deposit?'));
console.log('Your updated balance is ' +bankAccount.add(addAmount));
can anyone tell me why my account wont update my balance in last time of code?
Mbos95
@Mbos95
Sep 11 2015 07:08
Hey guys, just a quick question! I can't seem to easily change the colour of the navbar (Bootstrap). Anyone has a clue on how to do this ?
Mbos95
@Mbos95
Sep 11 2015 07:14
looks like I will have to either build navbar myself (Which is more fun) or get one from materialized css
kamleshgupta
@kamleshgupta
Sep 11 2015 07:14

@Dueldrawer8 Please check this
var bankAccount = {
total: 0,
add: function(addAmount){

     return this.total +=Number(addAmount);
},
subtract: function(subtractAmount){
    return this.total -= subtractAmount;

}

};

// be able to check my balance
console.log('Your current balance is ' +bankAccount.total);

// deposit some money.. update balance
var addAmount = prompt('How much money would you like to deposit?');
console.log('Your updated balance is ' +bankAccount.add((addAmount)));

It seems like the console.log that is used for prompt is setting the "this" to some other reference ,

schnedler
@schnedler
Sep 11 2015 08:26
When I sort this array [1000, 1001, 857, 1] why does it return this [857, 1001, 1000, 1]
sort().reverse() btw
but still
DTing
@dting
Sep 11 2015 08:37
@schnedler you need to pass the sort function a comparison function

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort

compareFunction
Optional. Specifies a function that defines the sort order. If omitted, the array is sorted according to each character's Unicode code point value, according to the string conversion of each element.

schnedler
@schnedler
Sep 11 2015 08:40
@dting Thank you! That worked. But on JS Bin I get a warning that I should not make a function within a loop. But it still works. Is it bad practice to do that?
CamperBot
@camperbot
Sep 11 2015 08:40
schnedler sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1115 | @dting | http://www.freecodecamp.com/dting
Dealga McArdle
@zeffii
Sep 11 2015 08:47
@schnedler, do you know what a 'tight loop' is?
schnedler
@schnedler
Sep 11 2015 08:49
Nope
Dealga McArdle
@zeffii
Sep 11 2015 08:50
a loop that is called many times ... like iterating over an array with 1000's of elements
Soumya Rauth
@soumyaRauth
Sep 11 2015 08:50
Bonfire: Diff Two Arrays ... Can anyone help?
CamperBot
@camperbot
Sep 11 2015 08:50
Sorry, can't find a bonfire called diff two arrays can anyone help. [ Check the map? ]
Dealga McArdle
@zeffii
Sep 11 2015 08:51
defining a function and calling it always adds a little overhead (extra processing cycles needed)
schnedler
@schnedler
Sep 11 2015 08:51
ahh, so it is not a good idea to use a function inside a tight loop, but in this case it is not a big deal
Dealga McArdle
@zeffii
Sep 11 2015 08:51
so when possible.. either define the function ahead of the loop... or avoid the function entirely..
schnedler
@schnedler
Sep 11 2015 08:52
It works, but it requires more processing power
got it, thank you!
CamperBot
@camperbot
Sep 11 2015 08:52
if you want to thank someone, put an @ before their name!
Dealga McArdle
@zeffii
Sep 11 2015 08:52
generally it's a sign that the code isn't designed optimally.
Fábio Paraíso Oliveira
@FabioParaiso
Sep 11 2015 08:52
@zeffii Was just reading but thanks for the definitions =)
CamperBot
@camperbot
Sep 11 2015 08:52
fabioparaiso sends brownie points to @zeffii :sparkles: :thumbsup: :sparkles:
:star: 332 | @zeffii | http://www.freecodecamp.com/zeffii
schnedler
@schnedler
Sep 11 2015 08:52
thank you @zeffii
CamperBot
@camperbot
Sep 11 2015 08:52
schnedler sends brownie points to @zeffii :sparkles: :thumbsup: :sparkles:
:star: 333 | @zeffii | http://www.freecodecamp.com/zeffii
Dealga McArdle
@zeffii
Sep 11 2015 08:53
but like you say... it will work, and sometimes you need to construct a function inside the loop :) .. just avoid doing it when it obviously isn't necessary
schnedler
@schnedler
Sep 11 2015 08:54
function largestOfFour(arr) {
  finalArr = [];
  for (i=0; i<arr.length; i++) {
    arr[i].sort(function(a,b) {
      return b - a;
    });
    finalArr.push(arr[i][0]);
    } 
  return finalArr;
}

function largestOfFour(arr) {
  var finalArr = [];  
  for (i=0; i<arr.length; i++) {
    finalArr.push(Math.max.apply( Math, arr[i] ));
  }
  return finalArr;
}
which of these two solutions would be preferable then?
DTing
@dting
Sep 11 2015 08:55
well sorting is O(n log n)
where as Math.max is O(n)
it also doesnt mutate your input
so probably the second version
Dealga McArdle
@zeffii
Sep 11 2015 08:55
This message was deleted
schnedler
@schnedler
Sep 11 2015 08:59
Thank you @dting Though I don’t get what you mean by O(n log n) and O(n)
CamperBot
@camperbot
Sep 11 2015 08:59
schnedler sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:warning: schnedler already gave dting points
DTing
@dting
Sep 11 2015 08:59
Hmm let me check something
Thats basically notation for time complexity of the operations
DTing
@dting
Sep 11 2015 09:03
Math.max will increase linearly. As you add more elements to the array the time it takes will increase linearly. Where as sorting an array will increase faster than linear.
schnedler
@schnedler
Sep 11 2015 09:04
ahh, yeah! Thank you!
CamperBot
@camperbot
Sep 11 2015 09:04
if you want to thank someone, put an @ before their name!
Dealga McArdle
@zeffii
Sep 11 2015 09:04
@schnedler O( ) is big O notation : https://en.wikipedia.org/wiki/Big_O_notation
Soumya Rauth
@soumyaRauth
Sep 11 2015 09:35
Need help with bonfire:Diff Two Arrays
CamperBot
@camperbot
Sep 11 2015 09:35
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Soumya Rauth
@soumyaRauth
Sep 11 2015 09:35
bonfire:Diff Two Arrays
Anyone willing to help?
function diff(arr1, arr2) {
  var newArr = [];
  var newArr2=[];
  // Same, same; but different.
  newArr2=arr1.concat(arr2);

  function compare(value){

    for(var i=0;i<newArr2.length;i++){

       for(var j=0;j<newArr2.length;j++){

         if(value===newArr2[j]){
           newArr2=newArr2.slice((newArr2.indexOf(value)+1),newArr2.length);
           return false;
         }

    }


    }

  }


  newArr=newArr2.filter(compare);

  return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
DTing
@dting
Sep 11 2015 09:37
@soumyaRauth you dont nee to iterate the arrays inside the compare function
Soumya Rauth
@soumyaRauth
Sep 11 2015 09:38
@dting You mean No loop is needed?
DTing
@dting
Sep 11 2015 09:38
ya.
one sec
bf diff
CamperBot
@camperbot
Sep 11 2015 09:38

:fire:Bonfire: Diff Two Arrays :link:

function diff(arr1, arr2) {
  var newArr = [];
  // Same, same; but different.
  return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);

Compare two arrays and return a new array with any items not found in both of the original arrays.

more info:  bf details | bf links | hint

DTing
@dting
Sep 11 2015 09:39
okay heres the thing. you start off by concating the 2 arrays.
then you filter using a function
how do you know when you should check if the element is on arr1 or check if it is in arr2?
hmm that was poorly stated.
let me rephrase that.
the goal of the challenge is to get an array that is not in both arrays.
Soumya Rauth
@soumyaRauth
Sep 11 2015 09:41
That means the result would be [4] in this case... right?
DTing
@dting
Sep 11 2015 09:42
yes. but lets take another example
[1,2],[2,3]
Soumya Rauth
@soumyaRauth
Sep 11 2015 09:42
[3] ????
[1,3]??
DTing
@dting
Sep 11 2015 09:43
[1,3] right?
Soumya Rauth
@soumyaRauth
Sep 11 2015 09:43
yap...
DTing
@dting
Sep 11 2015 09:43
okay so if you combine the arrays right away. how would you determine if they are not in either array.
how did you come up with [1,3] in your head?
Soumya Rauth
@soumyaRauth
Sep 11 2015 09:44
i first took 1....
Andy Taylor
@theador0691
Sep 11 2015 09:44
Does anyone know why this doesnt work for the diff tow arrays?
function diff(arr1, arr2) {
  var newArr = [];
  // Same, same; but different.
  arr1.sort();
  arr2.sort();

  for(var i=0;i<arr2.length;i++){
    console.log(arr2[i]);
    console.log(arr1.indexOf(arr2[i]));
    if(arr1.indexOf(arr2[i]) === -1){
      newArr.push(arr2[i]);
    }
  }
    for(var b=0;b<arr1.length;b++){
    console.log(arr1[b]);
    console.log(arr2.indexOf(arr1[b]));
    if(arr2.indexOf(arr1[b]) === -1){
      newArr.push(arr1[b]);
    }
  }
  console.log(newArr);
  return newArr;
}
Soumya Rauth
@soumyaRauth
Sep 11 2015 09:44
then compared it with 2... then 3
and may be pushed it in a newArr?
DTing
@dting
Sep 11 2015 09:45
so basically you looked at the first and found all the elements that werent in 2. then you looked at 2 and found all the elements not in 1
that works ya
so see if you can get that as code and you got your answer
Andy Taylor
@theador0691
Sep 11 2015 09:45
mine doesnt complete the last part
Dealga McArdle
@zeffii
Sep 11 2015 09:46
@theador0691 the .sort() is a little redundant there i think
Soumya Rauth
@soumyaRauth
Sep 11 2015 09:46
@dting then it is straight forward comparison... Why do I need those slice(), filter(), indexOf()????
Andy Taylor
@theador0691
Sep 11 2015 09:46
@zeffii i'm not sure that''s the issue though
Dealga McArdle
@zeffii
Sep 11 2015 09:46
yeah, but it's extra code..
DTing
@dting
Sep 11 2015 09:48
i'm not sure why you would use slice but i there is a solution with filter and indexOf.
haha
Soumya Rauth
@soumyaRauth
Sep 11 2015 09:48
@dting slice is recomended her.... That's why iam a bit of a confused..
Andy Taylor
@theador0691
Sep 11 2015 09:49
bf hint
CamperBot
@camperbot
Sep 11 2015 09:49
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
DTing
@dting
Sep 11 2015 09:49
@theador0691
function diff(arr1, arr2) {
  var newArr = [];
  // Same, same; but different.
  arr1.sort();
  arr2.sort();
    for(var b=0;b<arr1.length;b++){
    console.log(arr1[b]);
    console.log(arr2.indexOf(arr1[b]));
    if(arr2.indexOf(arr1[b]) === -1){
      newArr.push(arr1[b]);
    }
  }
  for(var i=0;i<arr2.length;i++){
    console.log(arr2[i]);
    console.log(arr1.indexOf(arr2[i]));
    if(arr1.indexOf(arr2[i]) === -1){
      newArr.push(arr2[i]);
    }
  }

  console.log(newArr);
  return newArr;
}
reverse the two loops
oh nm
Dealga McArdle
@zeffii
Sep 11 2015 09:49
This message was deleted
DTing
@dting
Sep 11 2015 09:49
let me look again
Andy Taylor
@theador0691
Sep 11 2015 09:50
that still didn't work :(
DTing
@dting
Sep 11 2015 09:50
remove the sort
and it works
Dealga McArdle
@zeffii
Sep 11 2015 09:50
whether you loop over arr2 or arr1 first doesn't really matter.. but convention would suggest it would be better to do something predictable and follow the convention of using arr1 first.. because it's called 1.. and then 2
Andy Taylor
@theador0691
Sep 11 2015 09:50
it doesnt work for this one
assert.deepEqual(diff([], ['snuffleupagus', 'cookie monster', 'elmo']), ['snuffleupagus', 'cookie monster', 'elmo'], 'empty array');
empty array: expected [ Array(3) ] to deeply equal [ Array(3) ]
that one gives me an error
ahh nm it worked when I took out the sorts!
Dealga McArdle
@zeffii
Sep 11 2015 09:51
oh the difference.. :)
Andy Taylor
@theador0691
Sep 11 2015 09:51
thanks @dting
CamperBot
@camperbot
Sep 11 2015 09:51
theador0691 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1118 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Sep 11 2015 09:53
interesting
some of the tests use includeMembers
some of them use deepEqual
lol
Dealga McArdle
@zeffii
Sep 11 2015 09:58
the grader gives a false sense of security some-times. I can imagine some of my solutions don't pass if more tests are added... but then again, some of the descriptions are a little short on details of expected output
DTing
@dting
Sep 11 2015 09:58
ya
Ian Hyndman
@ian-splintercell-splinter
Sep 11 2015 10:25
Hi campers i'm stuck on the icons to insert into my social media buttons. has any one got the time to help me.
DTing
@dting
Sep 11 2015 10:31
sure what are you working on?
Ian Hyndman
@ian-splintercell-splinter
Sep 11 2015 10:33
Soumya Rauth
@soumyaRauth
Sep 11 2015 10:34
function diff(arr1, arr2) {
  var newArr = [];
  var newArr2=[];
  //var newArr3=[];
  //var value;
  var remove;

  newArr2=arr1.concat(arr2);


  function compare(){

     for(var i=0;i<newArr2.length;i++){

   var value=newArr2[i];

    newArr2=newArr2.slice((i+1),newArr2.length);

    if(newArr2.indexOf(value)===-1){
      return true;
    }

    else {
      remove=newArr2.indexOf(value);
      newArr2=newArr2.splice(remove,1);
    return false;
  }

  }
  }

  newArr=newArr2.filter(compare);

  // Same, same; but different.
  return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
What is wrong????
DTing
@dting
Sep 11 2015 10:35
@ian-splintercell-splinter im not sure if it is what you are looking for but font awesome has the social medial icons
@soumyaRauth you aren't using the filter function correctly.
you should just be returning true or false from the callback whether or not you want to include the element the callback function was called with in the return array
right now you are reassigning newArr2 inside your filter function callback which will cause undesireable side effects.
Soumya Rauth
@soumyaRauth
Sep 11 2015 10:40
@dting sorry but I don't get it exactly.
DTing
@dting
Sep 11 2015 10:41
i'll give you an example of how filter works:
var a = [1,2,3,4,5];
a.filter(function(value) {
  return value % 2 === 0;
});
// [2,4]
Ian Hyndman
@ian-splintercell-splinter
Sep 11 2015 10:41
@dting thanks for your time i will try to google that
CamperBot
@camperbot
Sep 11 2015 10:41
ian-splintercell-splinter sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1121 | @dting | http://www.freecodecamp.com/dting
Soumya Rauth
@soumyaRauth
Sep 11 2015 10:43
@dting Can't I directly return true or false....
DTing
@dting
Sep 11 2015 10:43
@ian-splintercell-splinter cool i'll be around for a bit longer if you have questions
@soumyaRauth yes
Soumya Rauth
@soumyaRauth
Sep 11 2015 10:43
@dting But that's what I did!!!!
just brought a lil change...
function diff(arr1, arr2) {
  var newArr = [];
  var newArr2=[];
  //var newArr3=[];
  //var value;
  var remove;

  newArr2=arr1.concat(arr2);


  function compare(value){

     for(var i=0;i<newArr2.length;i++){

   //var value=newArr2[i];

    newArr2=newArr2.slice((i+1),newArr2.length);

    if(newArr2.indexOf(value)===-1){
      return true;
    }

    else {
      remove=newArr2.indexOf(value);
      newArr2=newArr2.splice(remove,1);
    return false;
  }

  }
  }

  newArr=newArr2.filter(compare);

  // Same, same; but different.
  return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
DTing
@dting
Sep 11 2015 10:44
you did return stuff
but you also have things that are removing things and doing stuff to your array
splice returns what you remove. then you assign it to newArr2
that compare function is called on each item in your newArry2 array
Soumya Rauth
@soumyaRauth
Sep 11 2015 10:47
oooooo..... So, will it work if I save the removed array into a newArray?
DTing
@dting
Sep 11 2015 10:48
you shouldnt be iterating your array that filter is iterating inside the callback. each value of the newArr2 will be used as an argument for that callback function
Ian Hyndman
@ian-splintercell-splinter
Sep 11 2015 10:49
@dting cheers mate i will probably need it
DTing
@dting
Sep 11 2015 10:49
honestly @soumyaRauth i would try to figure this out with out using filter first. then when you get the solution. convert it to using the functions.
Andrew Matthews
@rahzell
Sep 11 2015 11:07
Hi all, can you help me? Basic javascript last lession (40):
// Only change code below this line.

$($('.slot')[0]).html('<img src = "' +   images[slotOne-1] + '">');
$($('.slot')[1]).html('<img src = "' +   images[slotTwo-1] + '">');
$($('.slot')[2]).html('<img src = "' +   images[slotThree-1] + '">');

// Only change code above this line.
DTing
@dting
Sep 11 2015 11:07
@rahzell they use string matching to check your answer remove the spaces you added
Andrew Matthews
@rahzell
Sep 11 2015 11:07
its not working
ok thanks dting!
CamperBot
@camperbot
Sep 11 2015 11:07
if you want to thank someone, put an @ before their name!
samuel1290
@samuel1290
Sep 11 2015 11:27
hello
Ian Hyndman
@ian-splintercell-splinter
Sep 11 2015 11:27
Done it this line of code did the trick. <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
DTing
@dting
Sep 11 2015 11:36
@ian-splintercell-splinter nice you get it working?
Ian Hyndman
@ian-splintercell-splinter
Sep 11 2015 11:37
yes have a look see link
DTing
@dting
Sep 11 2015 11:56
@ian-splintercell-splinter nice
Jepz
@Jepz
Sep 11 2015 11:57
I have really hit a wall on the Zipline: Build a Pomodoro Clock. I just cant get starting with coding a timer. Does anyone have any good tips on where I can read up on tutorials or something? I have googled/stackedoverflowed alot but just cant get started...
Rory Smith
@alanbuchanan
Sep 11 2015 12:02
@dting would you mind sharing your solution for
bf pairwise
CamperBot
@camperbot
Sep 11 2015 12:02

:fire:Bonfire: Pairwise :link:

function pairwise(arr, arg) {
  return arg;
}

pairwise([1,4,2,3,0,5], 7);

Return the sum of all indices of elements of 'arr' that can be paired with one other element to form a sum that equals the value in the second argument 'arg'. If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another.

more info:  bf details | bf links | hint

Rory Smith
@alanbuchanan
Sep 11 2015 12:03
i did it only with loops and would like to see a functional approach
minakasiin
@minakasiin
Sep 11 2015 12:04
How the hell does instance look like, if I want to add some new properties to a object?
DTing
@dting
Sep 11 2015 12:06

@alanbuchanan hmm

function pairwise(arr, arg) {
  var sum = 0;
  arr.forEach(function(e, i, a) {
    if (e != null) {      
      var diff = arg-e;
      a[i] = null;
      var dix = a.indexOf(diff);
      if (dix !== -1) {
        sum += dix;
        sum += i;
        a[dix] = null;
      }  
    }
  });
  return sum;
}

give me a second i'll take another look at that one.

Dealga McArdle
@zeffii
Sep 11 2015 12:07
pairwise is by far the most difficult of all challenges on FCC. imho...
Rory Smith
@alanbuchanan
Sep 11 2015 12:08
@zeffii really? using nested loops i found it much easier than some
i don;t like how it links to Array.reduce() because i got mislead
Dealga McArdle
@zeffii
Sep 11 2015 12:09
it's interesting how people have problems with different challenges..
Rory Smith
@alanbuchanan
Sep 11 2015 12:11
@zeffii that orbital period is the only one that has truly dumbfounded me. but then i suppose that's because i stupidly forgot to use something that was staring me in the face
Dealga McArdle
@zeffii
Sep 11 2015 12:15
fair enough! i like the mathy ones :)
DTing
@dting
Sep 11 2015 12:19
function pairwise(arr, arg) {
  return arr.reduce(function(prev, cur, idx, array) {
    if (cur !== null) {
      var matchIndex = array.indexOf(arg-cur, idx+1);
      if (matchIndex !== -1) {
        array[matchIndex] = null;
        return prev + idx + matchIndex;
      }  
    }
    return prev;
  }, 0);
}
hmm thats still ugly
Rory Smith
@alanbuchanan
Sep 11 2015 12:21
ah, so it's possible only with reduce. i quite like that one
Ian Hyndman
@ian-splintercell-splinter
Sep 11 2015 12:57
Hi campers, i have another question, when i put this on my linux server. My images show but not the background pictures. Am i doing something wrong. ?
Moisés Man
@moigithub
Sep 11 2015 13:01
This message was deleted
Ammar Ali Shah
@AmmarAliShah
Sep 11 2015 13:05
Need help understanding a line of code
Ian Hyndman
@ian-splintercell-splinter
Sep 11 2015 13:05
the image with the chairs can not find this picture. works ok on localhost but not remote
Kat
@Mystfreak
Sep 11 2015 13:08
how do i add the property engines to my car
var myCar = new Car();
I only know how to do it in a function
Moisés Man
@moigithub
Sep 11 2015 13:09
once u have ur object created.. u can just
myobject.myNewProp = value
Kat
@Mystfreak
Sep 11 2015 13:10
@moigithub okay thanks
CamperBot
@camperbot
Sep 11 2015 13:10
mystfreak sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 327 | @moigithub | http://www.freecodecamp.com/moigithub
Moisés Man
@moigithub
Sep 11 2015 13:11
@ian-splintercell-splinter dont know. probably ur server blocking the site ? firewall or something.. an easy solution could be download the image, put on ur server, and fix the img path
accursedleaf
@accursedleaf
Sep 11 2015 13:12
On the Bonfire:Diff of Two challenge my code works and it works for all the tests except the last one giving me this ere...
error* expected [ Array(3) ] to deeply equal [ Array(3) ]
Kat
@Mystfreak
Sep 11 2015 13:13
it is not working
the error message = There should not be a property engine in the object constructor
I took it out
Ian Hyndman
@ian-splintercell-splinter
Sep 11 2015 13:13
@moigithub thankyou will try that
Kat
@Mystfreak
Sep 11 2015 13:13
but now I can't use object.property = value
no worries I did it another way
Sasa Popovic
@Zunior
Sep 11 2015 13:40
hi people. One little question. What the statement "/ig" means? I stumbled on it through course, but cannot find it again :-(
Dealga McArdle
@zeffii
Sep 11 2015 13:41
google it @Zunior
g means global (all)
DTing
@dting
Sep 11 2015 13:42
@Zunior i'm guessing you are referring to regex flags
Dealga McArdle
@zeffii
Sep 11 2015 13:42
and i means case insensitive
Sasa Popovic
@Zunior
Sep 11 2015 13:42
Yes found it. I was a little impatient
Manuel Niederl
@ManuelNiederl
Sep 11 2015 14:11
Hey everyone
Markus Legner
@mlegner
Sep 11 2015 14:12
hi
Manuel Niederl
@ManuelNiederl
Sep 11 2015 14:13
I'm having some problems implementing different backgrounds in the weather zipline
Could you please help?
Markus Legner
@mlegner
Sep 11 2015 14:15
I haven't done this yet, unfortunately.
Manuel Niederl
@ManuelNiederl
Sep 11 2015 14:16
Oh, don't worry. I'll ask around a bit later.
Fábio Paraíso Oliveira
@FabioParaiso
Sep 11 2015 14:17
@ManuelNiederl when you say diferent backgrounds do you mean one image after the other like the example?
Manuel Niederl
@ManuelNiederl
Sep 11 2015 14:21
@FabioParaiso I have an if statement that should implement a different background image depending on the current condition. But somehow it doesn't recognize the data given by yahoo. (If I use my own variable and assign values to it my if statement works) It´s probably pretty simple but I haven't been able to figure it out.
Fábio Paraíso Oliveira
@FabioParaiso
Sep 11 2015 14:22
Can you post the code =)
Manuel Niederl
@ManuelNiederl
Sep 11 2015 14:22
Of course :)
 if (weather.currently == 'Smoke' ) {
    $('body').css('background-image', 'url(http://i.imgur.com/cVTukTu.jpg)'); }
    else {
  if (weather.currently == 'snow') {
    $('body').css('background-image', 'url(http://i.imgur.com/KZoCXPV.jpg)'); }
      else {
  if (weather.currently == 'showers') {
          $('body').css('background-image', 'url(http://i.imgur.com/AVV51lC.jpg)')
        } 
      else {
          $('body').css('background-image', 'url(http://i.imgur.com/o6FfluE.jpg)')
        }}}
Somehow it always returns the "showers" image
even though the current condition is smoke
Fábio Paraíso Oliveira
@FabioParaiso
Sep 11 2015 14:24
yes it does =)
Manuel Niederl
@ManuelNiederl
Sep 11 2015 14:24
(That codepen integration is neat! )
Fábio Paraíso Oliveira
@FabioParaiso
Sep 11 2015 14:24
you are putting else { if and it should be else if {
so the compiler is only reading the last if and putting the sower image ;)
Manuel Niederl
@ManuelNiederl
Sep 11 2015 14:26
Hmm. Thats strange, it worked when I was using my own variable. But cool, I'll try that correction right now :)
Fábio Paraíso Oliveira
@FabioParaiso
Sep 11 2015 14:27
whats the weather btw ? you know the output of weather.currently?
Bill Zerega
@dedicatedfuture
Sep 11 2015 14:27
hello everyone
can anyone walk me through Waypoint: Make Object Properties Private?
Moisés Man
@moigithub
Sep 11 2015 14:29
@ManuelNiederl console.log(weather.currently);
probably ur matching string is different.. (upper or lower or capitalized probably )
Bill Zerega
@dedicatedfuture
Sep 11 2015 14:29
im having a hard time with Waypoint: Make Object Properties Private
not sure what i am doing wrong
Manuel Niederl
@ManuelNiederl
Sep 11 2015 14:30

It's giving me an error message. Would it be:

if (weather.currently == 'Smoke' ) {
    $('body').css('background-image', 'url(http://i.imgur.com/cVTukTu.jpg)'); }
    else 
  if { (weather.currently == 'snow') {

Is this the way it should be?
And @FabioParaiso The current weather is Smoke

Bill Zerega
@dedicatedfuture
Sep 11 2015 14:30
if anyone could walk me through Waypoint: Make Object Properties Private that would be just terrific
Manuel Niederl
@ManuelNiederl
Sep 11 2015 14:30
@moigithub
where can I see the output of console.log ?
Moisés Man
@moigithub
Sep 11 2015 14:30
before ur IF contidions
@dedicatedfuture post code
for private varriables u need to use var keyword to declare
Bill Zerega
@dedicatedfuture
Sep 11 2015 14:32

//Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
var myBike.getSpeed = 26;
var Bike = function() {
// Only change code below this line.
var myBike.speed = 12;
var myBike.addUnit = 3;

this.speed = 100;
function addUnit(value) {
return value + "KM/H";
}

getSpeed = function () {
return addUnit(speed);
};

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};

hmmm i didnt do that right did i
how do i post the code so it looks cleaner?
Moisés Man
@moigithub
Sep 11 2015 14:32
help format
CamperBot
@camperbot
Sep 11 2015 14:32

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

```js ⇦ Type 3 backticks, then type js or html and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Bill Zerega
@dedicatedfuture
Sep 11 2015 14:33

;//Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
var myBike.getSpeed = 26;
var Bike = function() {
// Only change code below this line.
var myBike.speed = 12;
var myBike.addUnit = 3;

this.speed = 100;
function addUnit(value) {
return value + "KM/H";
}

getSpeed = function () {
return addUnit(speed);
};

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};;

'//Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
var myBike.getSpeed = 26;
var Bike = function() {
// Only change code below this line.
var myBike.speed = 12;
var myBike.addUnit = 3;

this.speed = 100;
function addUnit(value) {
return value + "KM/H";
}

getSpeed = function () {
return addUnit(speed);
};

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};'

'''javascript //Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
var myBike.getSpeed = 26;
var Bike = function() {
// Only change code below this line.
var myBike.speed = 12;
var myBike.addUnit = 3;

this.speed = 100;
function addUnit(value) {
return value + "KM/H";
}

getSpeed = function () {
return addUnit(speed);
};

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};'''

CamperBot
@camperbot
Sep 11 2015 14:33
:bulb: to format code use backticks! ``` more info
Bill Zerega
@dedicatedfuture
Sep 11 2015 14:34

'''js //Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
var myBike.getSpeed = 26;
var Bike = function() {
// Only change code below this line.
var myBike.speed = 12;
var myBike.addUnit = 3;

this.speed = 100;
function addUnit(value) {
return value + "KM/H";
}

getSpeed = function () {
return addUnit(speed);
};

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();}; '''

CamperBot
@camperbot
Sep 11 2015 14:34
:bulb: to format code use backticks! ``` more info
Bill Zerega
@dedicatedfuture
Sep 11 2015 14:34

'''js //Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
var myBike.getSpeed = 26;
var Bike = function() {
// Only change code below this line.
var myBike.speed = 12;
var myBike.addUnit = 3;

this.speed = 100;
function addUnit(value) {
return value + "KM/H";
}

getSpeed = function () {
return addUnit(speed);
};

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};'''

CamperBot
@camperbot
Sep 11 2015 14:34
:bulb: to format code use backticks! ``` more info
Bill Zerega
@dedicatedfuture
Sep 11 2015 14:35

```js //Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
var myBike.getSpeed = 26;
var Bike = function() {
// Only change code below this line.
var myBike.speed = 12;
var myBike.addUnit = 3;

this.speed = 100;
function addUnit(value) {
return value + "KM/H";
}

getSpeed = function () {
return addUnit(speed);
};

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();}; ```

this is annoying
```js
Jelani Thompson
@JelaniThompson
Sep 11 2015 14:36
Bonfire where do I belong
CamperBot
@camperbot
Sep 11 2015 14:36

:fire:Bonfire: Where do I belong :link:

function where(arr, num) {
  // Find my place in this sorted array.
  return num;
}

where([40, 60], 50);

Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).

more info:  bf details | bf links | hint

Jelani Thompson
@JelaniThompson
Sep 11 2015 14:36
bf details
CamperBot
@camperbot
Sep 11 2015 14:36

:fire:Bonfire: Where do I belong :link:

function where(arr, num) {
  // Find my place in this sorted array.
  return num;
}

where([40, 60], 50);
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).
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
Jelani Thompson
@JelaniThompson
Sep 11 2015 14:36
Would this bonfire require a compareFunction?
Moisés Man
@moigithub
Sep 11 2015 14:38
u could but not really...
i used push+sort+indexOf @JelaniThompson
Jelani Thompson
@JelaniThompson
Sep 11 2015 14:38
Ah OK
Fábio Paraíso Oliveira
@FabioParaiso
Sep 11 2015 14:38
@ManuelNiederl like this else if (weather.currently == 'snow') {
you are putting an extra {
Manuel Niederl
@ManuelNiederl
Sep 11 2015 14:39
@FabioParaiso Cool, thanks :)
CamperBot
@camperbot
Sep 11 2015 14:39
manuelniederl sends brownie points to @fabioparaiso :sparkles: :thumbsup: :sparkles:
:star: 219 | @fabioparaiso | http://www.freecodecamp.com/fabioparaiso
Bill Zerega
@dedicatedfuture
Sep 11 2015 14:39
//Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
  this.gear = 1;
  function addStyle(styleMe){
    return 'The Current Gear Is: ' + styleMe;
  }
  this.getGear = function() {
    return addStyle(this.gear);
  };
};
var myBike.getSpeed = 26;
var Bike = function() {
  // Only change code below this line.
  var myBike.speed = 12;
  var myBike.addUnit = 3;

  this.speed = 100;
  function addUnit(value) {
    return value + "KM/H";
  }

  getSpeed = function () {
    return addUnit(speed);
  };

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};
there we go
got it
@moigithub do you see what i did wrong?
Jelani Thompson
@JelaniThompson
Sep 11 2015 14:40
@moigithub How would .indexOf() be helpful if it only returns the specified occurence of a value?
Moisés Man
@moigithub
Sep 11 2015 14:41
indexOf returns the index (position) of an element inside an array @JelaniThompson
Jelani Thompson
@JelaniThompson
Sep 11 2015 14:42
Yeah, but I thought we were only comparing num to the numbers in the array lol
Ariel
@ArielLeslie
Sep 11 2015 14:43
@dedicatedfuture All that myBike stuff that you have in/around the Bike function shouldn't be there. myBike is an instance of Bike created for testing
Bill Zerega
@dedicatedfuture
Sep 11 2015 14:44
where shoudl it be?
thats what the instructions ask you to make
Moisés Man
@moigithub
Sep 11 2015 14:46

@dedicatedfuture at bottom u have

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();

if u try to "play" with myCar or myBike above it doesnt exist yet.. so all ur code related to those 2 should be below

Bill Zerega
@dedicatedfuture
Sep 11 2015 14:47
thats what i thought
but the directions clearly state
above that line
is this a buggy waypoint?
David Glauber
@davidglbr
Sep 11 2015 14:51

After a few years of coding interviews, my friends and I noticed we always have a hard time finding good practice buddies. There was no place to get real practice & prep, so we built Pramp for developers like us.

Pramp is a free peer-2-peer practice platform for coding interviews.
We pair you to other programmers at your level and give you full interview questions & solutions. On each interview you and your peer interview each other on our site using video chat & collaborative code editor.

Bill Zerega
@dedicatedfuture
Sep 11 2015 14:52
if anyone could explain to me how I am supposed to pass Waypoint: Make Object Properties Private I would be greatly appreciative
Moisés Man
@moigithub
Sep 11 2015 14:52
@dedicatedfuture probably u need to modify the declaration.. that means u dont use the variables "myCar" /"myBike" .. but Bike or Car, if outside the function declaration.. OR this/var keywords if inside..
Bill Zerega
@dedicatedfuture
Sep 11 2015 14:54
See if you can keep myBike.speed and myBike.addUnit private, while making myBike.getSpeed publicly accessible.
thats the instructions
does that mean I have to use myBike.speed or is this some kind of parent/child thing?
Moisés Man
@moigithub
Sep 11 2015 14:55
ok.. was checking what i did...
Jelani Thompson
@JelaniThompson
Sep 11 2015 14:56
function where(arr, num) {
  // Find my place in this sorted array.
  var arr = [];
  arr.push(num);
  var numPosition = arr.indexOf(num);

  for (var i = 0; i < arr.length; i++) {

  }
  return num;
}

where([40, 60], 50);
All right, so there's my code so far though
Moisés Man
@moigithub
Sep 11 2015 14:56
u need to modify
var Bike = function() {
inside it have ' speed' variable u neeed to make it private..
u use var keyword to declare as private
i.e. var myvariable = 100;
Jelani Thompson
@JelaniThompson
Sep 11 2015 14:57
Still kinda confused as to how I could apply indexOf() to this situation though
Bill Zerega
@dedicatedfuture
Sep 11 2015 14:58
thank you for your help and patience @moigithub
CamperBot
@camperbot
Sep 11 2015 14:58
dedicatedfuture sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 328 | @moigithub | http://www.freecodecamp.com/moigithub
Moisés Man
@moigithub
Sep 11 2015 14:58
@dedicatedfuture the the funciton getSpeed u need to "attach" it to Bike .. using this keyword
Mateja Trifunovski
@Matko95
Sep 11 2015 14:58
expect(sumFibs(75025)).to.equal(135721);expected 60696 to equal 135721.
My fibonacci calculator can't pass this test
Jeremy Gorniak
@Gornstats
Sep 11 2015 14:59
@Matko95 looks like your one iteration off?
Mateja Trifunovski
@Matko95
Sep 11 2015 15:00
And when i make it that that one passes, all others fail
@Gornstats It does seem like it, but all other tests pass
Moisés Man
@moigithub
Sep 11 2015 15:01
@JelaniThompson do u know how to open dev tools... and put javscript commands on console?
Bill Zerega
@dedicatedfuture
Sep 11 2015 15:01
//Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
  this.gear = 1;
  function addStyle(styleMe){
    return 'The Current Gear Is: ' + styleMe;
  }
  this.getGear = function() {
    return addStyle(this.gear);
  };
};

var Bike = function() {
  // Only change code below this line.

  var speed = 12;
  var addUnit =3;
  this.speed = 100;
  function addUnit(value) {
    return value + "KM/H";
  }

  getSpeed = function () {
    return addUnit(speed);
    this.Bike
  };
};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();


if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};
im still not doing this right am i?
@moigithub
Jelani Thompson
@JelaniThompson
Sep 11 2015 15:02
@moigithub Yep
Moisés Man
@moigithub
Sep 11 2015 15:02
@dedicatedfuture u no need to add more variables.. but change the speed declaration
from this.speed to ...
Ariel
@ArielLeslie
Sep 11 2015 15:02
@dedicatedfuture among other things, this.Bike will break things
Mateja Trifunovski
@Matko95
Sep 11 2015 15:03
@Gornstats I fixed it :)
justindobbs
@justindobbs
Sep 11 2015 15:03
@JelaniThompson to check if a value is in an array with .indexOf() use like this:
Mateja Trifunovski
@Matko95
Sep 11 2015 15:03
@Gornstats thanks anyway
CamperBot
@camperbot
Sep 11 2015 15:03
matko95 sends brownie points to @gornstats :sparkles: :thumbsup: :sparkles:
:star: 295 | @gornstats | http://www.freecodecamp.com/gornstats
Jeremy Gorniak
@Gornstats
Sep 11 2015 15:04
@Matko95 good to hear. did you use recursion or a loop?
Moisés Man
@moigithub
Sep 11 2015 15:04
@JelaniThompson an example of indexOf
[1,2,3,4].indexOf(3)
u can read as.. where the number 3 is on the array (or something like that :P )
it should return 2
justindobbs
@justindobbs
Sep 11 2015 15:04
if( arr.indexOf(val) !== -1){
   return true;
}
you can also use the tilde operator
Mateja Trifunovski
@Matko95
Sep 11 2015 15:04
@Gornstats I used a loop which breaks on if(fibonacci>num), the problem was that i have put if(fibonacci>=num), and it would break and they put exactly that number
justindobbs
@justindobbs
Sep 11 2015 15:05
if( ~arr.indexOf(val){
  return true;
}
Jelani Thompson
@JelaniThompson
Sep 11 2015 15:05
Alrighty, thanks so much @justindobbs and @moigithub :D
CamperBot
@camperbot
Sep 11 2015 15:05
jelanithompson sends brownie points to @justindobbs and @moigithub :sparkles: :thumbsup: :sparkles:
:star: 304 | @justindobbs | http://www.freecodecamp.com/justindobbs
:star: 329 | @moigithub | http://www.freecodecamp.com/moigithub
justindobbs
@justindobbs
Sep 11 2015 15:06
here's also a pen that demonstrates it http://codepen.io/thebigpumpkin/pen/gaYEQe
Jelani Thompson
@JelaniThompson
Sep 11 2015 15:10
function where(arr, num) {
arr.push(num);
var sortedarr = arr.sort(function(a,b){return a-b;});
var wheresarr = sortedarr.indexOf(num);
return wheresarr;
}
Bill Zerega
@dedicatedfuture
Sep 11 2015 15:10
Thank you @moigithub and @ArielLeslie , I have now gotten the private declarations
CamperBot
@camperbot
Sep 11 2015 15:10
dedicatedfuture sends brownie points to @moigithub and @arielleslie :sparkles: :thumbsup: :sparkles:
:warning: dedicatedfuture already gave moigithub points
:star: 373 | @arielleslie | http://www.freecodecamp.com/arielleslie
Bill Zerega
@dedicatedfuture
Sep 11 2015 15:11
but im still not understanding the public declarations
Ariel
@ArielLeslie
Sep 11 2015 15:11
@dedicatedfuture :clap:
Jelani Thompson
@JelaniThompson
Sep 11 2015 15:11
Can anyone explain how the compare function in return works?
Bill Zerega
@dedicatedfuture
Sep 11 2015 15:11
i know to use this. but not sure what to attach to it
Ariel
@ArielLeslie
Sep 11 2015 15:11
@dedicatedfuture The thing you did to make speed private? Do the opposite to what you want to make public
@dedicatedfuture Basically, what word do you want to be able to put after myBike.?
Put the this. in front of that.
Bill Zerega
@dedicatedfuture
Sep 11 2015 15:12
hmmm
this.getSpeed in the getSpeed function?
Ariel
@ArielLeslie
Sep 11 2015 15:13
(Programming, where saying "Put the this in front of that" is both valid and sensical)
@dedicatedfuture :+1:
Moisés Man
@moigithub
Sep 11 2015 15:13
:clap:
Bill Zerega
@dedicatedfuture
Sep 11 2015 15:16
i appreciate all your guys help but im still not passing the public test
Moisés Man
@moigithub
Sep 11 2015 15:17
repost code again :)
Bill Zerega
@dedicatedfuture
Sep 11 2015 15:18
//Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
  this.gear = 1;
  function addStyle(styleMe){
    return 'The Current Gear Is: ' + styleMe;
  }
  this.getGear = function() {
    return addStyle(this.gear);
  };
};

var Bike = function() {
  // Only change code below this line.

  var speed = 12;
  var addUnit =3;

  function addUnit(value) {
    return value + "KM/H";
  }

  this.getSpeed = function () {
    return addUnit(speed);


  };

};

// Only change code above this line.
var myCar = new Car();
var myBike = new Bike();


if(myBike.hasOwnProperty('getSpeed')){(function() {return JSON.stringify(myBike.getSpeed());})();};
ive been playing with the this.getSpeed in all different places
there i just threw a this. on the getSpeed function declaration
Ariel
@ArielLeslie
Sep 11 2015 15:19
That looks right...
Moisés Man
@moigithub
Sep 11 2015 15:20
var addUnit =3; remove that line
Bill Zerega
@dedicatedfuture
Sep 11 2015 15:20
it passes the test
Ariel
@ArielLeslie
Sep 11 2015 15:20
aha! @moigithub is right
Bill Zerega
@dedicatedfuture
Sep 11 2015 15:20
wow
yea
you called it
you 2 are smart @moigithub @ArielLeslie
just so that i understand this correctly, the addUnit property was always with the myBike variable?
we didnt have to change anything for it to be privately declared because of the function
Christoffer92
@Christoffer92
Sep 11 2015 15:29
 // Bonfire: Seek and Destroy.
/* 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.

Remember to use Read-Search-Ask if you get stuck. Write your own code.

Here are some helpful links:

Arguments object
Array.filter()
*/

function destroyerFilter(value){
  /*Somehow i want numOfArguments and all the arguments in this function.
    That way i can do basic logical operands and return true if value == one of the arguments. */
}

function destroyer(arr) {
  // Remove all the values

  var numOfArguments = arguments.length-1

  arr = arr.filter(destroyerFilter);

  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Ariel
@ArielLeslie
Sep 11 2015 15:30
@dedicatedfuture That's right
except not the myBike variable, but the Bike object. You could create a yourBike variable which is a different Bike
Bill Zerega
@dedicatedfuture
Sep 11 2015 15:31
the myBike inherritted it from Bike object?
Ariel
@ArielLeslie
Sep 11 2015 15:32
myBike is a Bike object, just like 42 is an Int
Rory Smith
@alanbuchanan
Sep 11 2015 15:37
@Christoffer92 you're on the right track
@Christoffer92 in your destroyerFilter function, you just need to return a statement that equates to either true or false
Comfort
@freecodecomfort
Sep 11 2015 15:43
Hello, has someone completed the Zipline: Show the Local Weather?
Christoffer92
@Christoffer92
Sep 11 2015 15:44
@alanbuchanan But.. I dont know how to pass the agurments prober from to the function destroyerFilter :/ i tried with destroyerFilter(arguments, numOfArguments); I could do my best try, and show you where i get stuck
Rory Smith
@alanbuchanan
Sep 11 2015 15:45
@Christoffer92 here is a hint:
var args = [];
args.push(arguments[1], arguments[2]);
at least, that's how i might approach it
of course, that would only satisfy two extra arguments
vkarla
@vkarla
Sep 11 2015 16:02

@vkarla
function palindrome(str) {
// Good luck
var str1 = str.toLowerCase();
str1 = str1.replace(/\s/g,'');
str1 = str1.replace(/[,]/g,'');
str1=str1.replace(/[.]/g, '');
str1=str1.replace(/[?]/g, '');
str1=str1.replace(/[_]/g, '-');

var str2 = str1.split('').reverse().join('');
return str2===str1;
}

palindrome("0_0 (: /-\ :) 0-0");
This is my code. But it tells me that this one I put in palindrome(); function is a palindrome, but my program tells false. you can see that between first nulls you have -, and between last ones you have -. So what is the problem? I tried to replace this to signs, but it doesn't help.

Soumya Rauth
@soumyaRauth
Sep 11 2015 16:03
I have submitted a zipline on FCC... If later I find it buggy what should I do??
Rory Smith
@alanbuchanan
Sep 11 2015 16:04
@vkarla saw this yesterday and didn't understand it. then i realised. it 's because of what you're replacing in your regex.
you don't need all those separate replace statements, you can put them all into one
@vkarla furthermore, there is a very short regex that will deal with many of those characters and more
i always test regex here because it makes more sense
Guilherme Samora
@guipsamora
Sep 11 2015 16:08
HELP! My code crashed the browser but as it is saved anytime I go to the Bonfire the browser crashes again! What should I do?
CamperBot
@camperbot
Sep 11 2015 16:08
no wiki entry for: my code crashed the browser but as it is saved anytime i go to the bonfire the browser crashes again what should i do
:pencil: click here to create one now!after creating your page type update to reload it here
Rory Smith
@alanbuchanan
Sep 11 2015 16:09
@guipsamora are you using a for or while loop in your code?
Valon Haliti
@valonhaliti
Sep 11 2015 16:13
can somebody give me a hint at Bonfire: Diff Two Arrays
Moisés Man
@moigithub
Sep 11 2015 16:21
help localstorage
CamperBot
@camperbot
Sep 11 2015 16:21
no wiki entry for: localstorage
:pencil: click here to create one now!after creating your page type update to reload it here
Guilherme Samora
@guipsamora
Sep 11 2015 16:21
@alanbuchanan yes I am.
SojournerOctocat
@SojournerOctocat
Sep 11 2015 16:22
@valonfhaliti I used filter to filter values for one array. Then I used filter to filter values for the second array. Then concat the two filtered values.
Soumya Rauth
@soumyaRauth
Sep 11 2015 16:22
SojournerOctocat
@SojournerOctocat
Sep 11 2015 16:22
Does that help?
Rory Smith
@alanbuchanan
Sep 11 2015 16:22
@guipsamora have you tried clearing the cache?
Moisés Man
@moigithub
Sep 11 2015 16:23
@guipsamora u need to open devtools.. go to Resources -> local Storage, find ur exercise and delete that entry
@guipsamora there were a guide on camperbot but i cant find
SojournerOctocat
@SojournerOctocat
Sep 11 2015 16:24
js localstorage
js storage
wiki storage
CamperBot
@camperbot
Sep 11 2015 16:24

:point_right: clear your browser's local storage [wiki]

Removing all your locally stored challenges will solve many problems related to the browser crashing on FreeCodeCamp

In Chrome:

  • On 'freecodecamp.com' open your console
    • Windows: Ctrl + Shift + J
    • Mac OS: Cmd + Opt + J
  • Go to resources tab(chrome).
    • There click on the localStorate link in the nav bar on the right.
  • Delete all the entries on the right side.
  • See if this solves your issue

Alternatively, if you are having issue's with a specific challenge freezing your browser find the name of that challenge in local storage and delete just that one.
:pencil: read more about clear your browsers local storage on the FCC Wiki

Tom Lorimer
@Ellf
Sep 11 2015 16:26
Bonfire: Chunky Monkey hint
CamperBot
@camperbot
Sep 11 2015 16:26
Sorry, can't find a bonfire called chunky monkey hint. [ Check the map? ]
Tom Lorimer
@Ellf
Sep 11 2015 16:26
Bonfire: Chunky Monkey
CamperBot
@camperbot
Sep 11 2015 16:26

:fire:Bonfire: Chunky Monkey :link:

function chunk(arr, size) {
  // Break it up.
  return arr;
}

chunk(['a', 'b', 'c', 'd'], 2);

Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.

more info:  bf details | bf links | hint

Tom Lorimer
@Ellf
Sep 11 2015 16:26
bf hint
CamperBot
@camperbot
Sep 11 2015 16:26
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Christoffer92
@Christoffer92
Sep 11 2015 16:26
Hi this is so far i have got with Bonfire: Seek and Destroy.
function destroyerFilter(value){

  var numOfArguments = arguments[1].length;
  var argumentArray = arguments[1];

  for (var i = 0; i<numOfArguments; i++){
  if (value == argumentArray[i]){
    return false;
    }
  }
   return true;
}

function destroyer(arr) {
  // Remove all the values

  var numOfArguments = arguments.length-1; 
  var arrayArguments = [];

  for (i=1; i<numOfArguments+1; i++){
    arrayArguments.push(arguments[i]);
  } 

  arr.push(arrayArguments);
  arr = arr.filter(destroyerFilter);


  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
I cant seem to get it to work. The result is [1, 2, 3, 1, 2, 3, [2, 3]]. It is as if it ignores my for loop in the destroyerFilter, function.
@alanbuchanan Would you take one more look? ;)
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:29
Hi @Christoffer92
Christoffer92
@Christoffer92
Sep 11 2015 16:29
@AnindyoSen Hi
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:29
have u completed falsy bouncer ? :P
Christoffer92
@Christoffer92
Sep 11 2015 16:29
@AnindyoSen yup :)
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:29
I cudnt get it right

function bouncer(arr) {
// Don't show a false ID to this bouncer.
arr = arr.filter(function(n){
return (n !== undefined && n !== null && n !== false && n !== 0 && n !== "" && n!== isNaN)
});
return arr;
}

bouncer([false, null, 0, NaN, undefined, '']);

Valon Haliti
@valonhaliti
Sep 11 2015 16:30
@SojournerOctocat I'm sorry I don't understand
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:30
When all elements are Falsy .. my code doesnt return empty Array
Christoffer92
@Christoffer92
Sep 11 2015 16:30
@AnindyoSen do you get the [null, null, null] result?
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:31
yes
@Christoffer92 do u know why it is coming ?
SojournerOctocat
@SojournerOctocat
Sep 11 2015 16:31
@valonfhaliti Do you know how to use the filter statement?
ThankGod Richard
@thankgodr
Sep 11 2015 16:31
Please i need help on the following code. it is not printing out the conversion
Rory Smith
@alanbuchanan
Sep 11 2015 16:32
@Christoffer92 your destroyerFilter function only needs to contain one line
Valon Haliti
@valonhaliti
Sep 11 2015 16:32
Filter checks members of array, than returns a value that we want to return?
Christoffer92
@Christoffer92
Sep 11 2015 16:33
@AnindyoSen First of, you need to have it so n! == undefined || n! == null. and so on. The || . so value != 1 || value != 2 means it value is not 1 Or if the value is not 2.
Valon Haliti
@valonhaliti
Sep 11 2015 16:33
not a value, but an array with members that return true, at or condition
Christoffer92
@Christoffer92
Sep 11 2015 16:33
@alanbuchanan I really have no idea how to do this one then :s i might need to sleep on it then
This message was deleted
Ariel
@ArielLeslie
Sep 11 2015 16:34
@valonfhaliti filter creates a new array that contains only the members that resulted in true
SojournerOctocat
@SojournerOctocat
Sep 11 2015 16:34
@valonfhaliti Filter can return an array of values.
Christoffer92
@Christoffer92
Sep 11 2015 16:34
@AnindyoSen means if value is not 1 OR if the value is not 2*
Moisés Man
@moigithub
Sep 11 2015 16:34
@Christoffer92 EACH functions have his OWN arguments object copy, and all those arguments object copy are differents, depending on what data u pass to it
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:34
@Christoffer92 Shall i use && ?
Christoffer92
@Christoffer92
Sep 11 2015 16:35
@moigithub thats why i pushed the arguments after the array from the destroyer function.
Valon Haliti
@valonhaliti
Sep 11 2015 16:35
yes, and what condition we use at our case, I don't understand
Christoffer92
@Christoffer92
Sep 11 2015 16:35
@AnindyoSen you should use ||
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:35
@Christoffer92 Ohh sorry . ... ok i will try using ||
Rory Smith
@alanbuchanan
Sep 11 2015 16:36
Screen Shot 2015-09-11 at 17.35.29.png
@Christoffer92 look at your value of arrayArguments
SojournerOctocat
@SojournerOctocat
Sep 11 2015 16:36
@valonfhaliti I used an if statement to check and see if the second array contained the element of the first array.
ThankGod Richard
@thankgodr
Sep 11 2015 16:36
var Conversion = function () {
    this.convert = function (x , y , inti) {
        if (x === 0 && y === 1) {

            return inti *= 200;

        }
        if (x === 0 && y === 2)return inti *= 150;
        if (x === 1 && y === 0) {
            inti = inti / 200;
            return inti;
        }
        else if (x === 1 && y === 2) {
            inti = inti / 50;
            return inti;
        }
        else if (x === 2 && y === 0) {
            inti = inti / 150;
            return inti;
        }
        else if (x === 2 && y === 1) {
            inti = inti * 50;
            return inti;
        }
    }
};
function converts() {
    var element1 = document.getElementById("form");
    var passArg = element1.options[element1.selectedIndex];
    var passArg2 = document.getElementById("convert2");
    var rende = passArg2.options[passArg2.selectedIndex];
    var input = document.getElementById("input1").value;
    var input2 = document.getElementById("input2").value;
    var price = new Conversion();
    var p = price.convert(passArg, rende, input);
    p = input2;
}
Rory Smith
@alanbuchanan
Sep 11 2015 16:36
@Christoffer92 these are the numbers to test
@Christoffer92 there's no need to push them onto the original arr
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:37
@Christoffer92 its not working
SojournerOctocat
@SojournerOctocat
Sep 11 2015 16:37
@valonfhaliti Filter tests each element in an array. For each element tested, I used the if statement to see if that element was present in the other array.
Does that help?
ThankGod Richard
@thankgodr
Sep 11 2015 16:38
please p = input2 is showing on the html document
Valon Haliti
@valonhaliti
Sep 11 2015 16:38
oh, I get the logic, thank you
CamperBot
@camperbot
Sep 11 2015 16:38
if you want to thank someone, put an @ before their name!
Valon Haliti
@valonhaliti
Sep 11 2015 16:38
@SojournerOctocat thank you.
@SojournerOctocat thanks.
CamperBot
@camperbot
Sep 11 2015 16:38
valonfhaliti sends brownie points to @sojourneroctocat :sparkles: :thumbsup: :sparkles:
:star: 280 | @sojourneroctocat | http://www.freecodecamp.com/sojourneroctocat
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:39
@Christoffer92 Can u paste ur code for falsy bouncer ?
Christoffer92
@Christoffer92
Sep 11 2015 16:39
@alanbuchanan But i cant send the numbers i wish to test with the function destroyerFilter. Like if i use arr.filter((destroyerFilter(2, 3));
It would not suit the filter method :/
Moisés Man
@moigithub
Sep 11 2015 16:40
@Christoffer92 i seen u using arguments inside destroyer function and ALSO ON destroyFilter function
if u have this [1,2,3.4].filter ( callback )
each number on the array (one by one) will be passed to the callback
so on ur destroyerFilter function arguments will only have 1 value (which will be each numbers on the array ) (remember each function have his own copy of arguments )
sooo.. u CAN NOT access var argumentArray = arguments[1]; <-- index 1
Christoffer92
@Christoffer92
Sep 11 2015 16:41
@AnindyoSen Yes, im sorry AnindyoSen kinda frustated i cant get the other one correct, here is my version of the bouncer:
function falsyValues(value){  

  if (value == null || value == false || value == 0 || value == "")
    return 0;
  else
    return value;
}

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  arr = arr.filter(falsyValues);

  return arr;
}

bouncer([null]);//false, null, 0, NaN, undefined, '']);    //null, undefined & NaN, have false id's.
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:42
@Christoffer92 Thank You
@Christoffer92 will move on to seek & destroy .. will try to help u in that one
Christoffer92
@Christoffer92
Sep 11 2015 16:42
@AnindyoSen the last return that was there should been ignored, i dit idet my post so it should be correct :)
Anindyo Sen
@AnindyoSen
Sep 11 2015 16:43
Ok
Rory Smith
@alanbuchanan
Sep 11 2015 16:43

@Christoffer92

return arr.filter(function(num){

});

i would try working with this instead of calling a separate function

Christoffer92
@Christoffer92
Sep 11 2015 16:43
@moigithub thanks
CamperBot
@camperbot
Sep 11 2015 16:43
christoffer92 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 330 | @moigithub | http://www.freecodecamp.com/moigithub
Christoffer92
@Christoffer92
Sep 11 2015 16:44
@alanbuchanan but isn't that a separate function? or those a function in a function behave diffrently?
Moisés Man
@moigithub
Sep 11 2015 16:45
@Christoffer92 move this outside on top of all
var arrayArguments = [];
then on ur destroyerFilter u can access that array and do ur checks
Rory Smith
@alanbuchanan
Sep 11 2015 16:45
@Christoffer92 it doesn't behave differently but i find it less confusing
@Christoffer92 especially as you only need one line
Guilherme Samora
@guipsamora
Sep 11 2015 16:46
@moigithub @alanbuchanan @SojournerOctocat thank you!! It worked! 🙏
CamperBot
@camperbot
Sep 11 2015 16:46
guipsamora sends brownie points to @moigithub and @alanbuchanan and @sojourneroctocat :sparkles: :thumbsup: :sparkles:
:star: 281 | @sojourneroctocat | http://www.freecodecamp.com/sojourneroctocat
:star: 323 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
:star: 331 | @moigithub | http://www.freecodecamp.com/moigithub
Christoffer92
@Christoffer92
Sep 11 2015 16:47
@moigithub wauw didnt knew, thanks! that changes alot
Moisés Man
@moigithub
Sep 11 2015 16:51
@Christoffer92 depending where u declare ur variables /functions it set an "SCOPE" (accesibility)
and it (always) go from outside to inside.. (never in to out )
http://msexcel.analysistabs1.netdna-cdn.com/wp/wp-content/uploads/2013/03/Scope.png
Christoffer92
@Christoffer92
Sep 11 2015 16:52
@moigithub thanks yeah i knew about scoop, i just though you were suppose to treat the exercisis as the main scope in the first function
CamperBot
@camperbot
Sep 11 2015 16:52
christoffer92 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:warning: christoffer92 already gave moigithub points
AnbuKakashi
@AnbuKakashi
Sep 11 2015 17:14
hey guys
im a bit stuck here
could you look at the picture
Bill
@kirah1314
Sep 11 2015 17:16
help format
CamperBot
@camperbot
Sep 11 2015 17:16

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

```js ⇦ Type 3 backticks, then type js or html and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Rory Smith
@alanbuchanan
Sep 11 2015 17:18
@AnbuKakashi i think you just have to drop the ,
AnbuKakashi
@AnbuKakashi
Sep 11 2015 17:19
@alanbuchanan tnank you that was the solution :D
@alanbuchanan thank you :D
CamperBot
@camperbot
Sep 11 2015 17:20
anbukakashi sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 324 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Rory Smith
@alanbuchanan
Sep 11 2015 17:21
@AnbuKakashi classes are always separated only with a space, regardless of how many there are :+1:
Oscar Lopez Guzman
@olopezg
Sep 11 2015 17:26
This message was deleted
calisham
@calisham
Sep 11 2015 17:27
would someone who knows CSS mind helping me with my portfolio zipline?
I'm trying to get my menu to center, but can't seem to figure it out
AnbuKakashi
@AnbuKakashi
Sep 11 2015 17:29
i will keep that in mind tnx :D
CamperBot
@camperbot
Sep 11 2015 17:29
if you want to thank someone, put an @ before their name!
Nathan Wind
@Nathan-Wind
Sep 11 2015 17:30

HI guys... why isn;t this working? //Here is a sample Object
var car = {
"wheels":4,
"engines":1,
"seats":5
};

//Now Let's make a similar Object called motorBike
//Give it two wheels, one engine and one seat
var motorBike = {
// Only change code below this line.
"wheels":2,
"engines":1,
"seats":1
};

Bill
@kirah1314
Sep 11 2015 17:33
@Nathan-Wind looks pretty good, click run code again. Sometimes I had to click run code 3 times to get it across
Rex Schrader
@SaintPeter
Sep 11 2015 17:34
@calisham I can help
Nathan Wind
@Nathan-Wind
Sep 11 2015 17:34
keeps giving me Program Execution FailureNo user tests were run.
Rory Smith
@alanbuchanan
Sep 11 2015 17:34
@Nathan-Wind it's because you have one too many };, i think :)
Nathan Wind
@Nathan-Wind
Sep 11 2015 17:35
hmmm
Rex Schrader
@SaintPeter
Sep 11 2015 17:35
@calisham In general, for a fixed width object, do this:
.center-me {
  width: 400px;  /* or any other fixed width */
  margin-left: auto;
  margin-right:auto;
}
Nathan Wind
@Nathan-Wind
Sep 11 2015 17:35
@alanbuchanan lol yep. well that was 30 minutes of my day. lol
@alanbuchanan Thanks
CamperBot
@camperbot
Sep 11 2015 17:36
nathan-wind sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 326 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Bill
@kirah1314
Sep 11 2015 17:36
@alanbuchanan good catch there lol
Rory Smith
@alanbuchanan
Sep 11 2015 17:36
@Nathan-Wind the placement of their comments make it confusing
@kirah1314 :)
Bill
@kirah1314
Sep 11 2015 17:37
is it because they already had a };?
Nathan Wind
@Nathan-Wind
Sep 11 2015 17:37
yeah exactly
Bill
@kirah1314
Sep 11 2015 17:37
ah ok and you added another one, good to know
Nathan Wind
@Nathan-Wind
Sep 11 2015 17:37
the comments placement threw me off. can you tell I'm rookie? hahaha
who wants to hire me? really i need a job lololol
Rex Schrader
@SaintPeter
Sep 11 2015 17:40
@Nathan-Wind That's why we have tools like jsLint
calisham
@calisham
Sep 11 2015 17:41
@SaintPeter thanks. It's not working for me. Can you take a look at my code? Can't figure out where to put this so that it works.
CamperBot
@camperbot
Sep 11 2015 17:41
calisham sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 574 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 11 2015 17:41
@calisham Sure, let me take a look
calisham
@calisham
Sep 11 2015 17:42
I put the style markup under subnav @SaintPeter
Nathan Wind
@Nathan-Wind
Sep 11 2015 17:42
@SaintPeter cool thanks that will help...
CamperBot
@camperbot
Sep 11 2015 17:42
nathan-wind sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 575 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 11 2015 17:43
@calisham What precisely do you want centered? Your name? Or the Menu on the Navbar?
calisham
@calisham
Sep 11 2015 17:43
Oh, the buttons below the jumbotron
Rex Schrader
@SaintPeter
Sep 11 2015 17:43
@calisham Ah, ok
calisham
@calisham
Sep 11 2015 17:43
the subnav class
Rex Schrader
@SaintPeter
Sep 11 2015 17:47
@calisham ok, two issues:
1) You need to apply the margin settings to .subnav, not .subnav ul
2) You have to remove the col-md-12 from the actual div you have applied subnav to - it is overriding the width of the element.
calisham
@calisham
Sep 11 2015 17:48
ohhh ok thanks @SaintPeter
CamperBot
@camperbot
Sep 11 2015 17:48
calisham sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: calisham already gave saintpeter points
Josh
@obscureether
Sep 11 2015 17:50

can someone tell me what is wrong with this code?==>
```html

<script>
$(document).ready(function() {
$("button").addclass("animated bounce");
});
</script>

Will Moody
@willmoody
Sep 11 2015 17:50
This message was deleted
Missed a semicolon, haha. Nevermind! :P
Josh
@obscureether
Sep 11 2015 17:54
nv mind did not do a cap...
Lee Doyle
@ldoyle0
Sep 11 2015 18:13

I am working on the Bonfire: Seek and Destroy. How does one check a list of indexes? I just dont know how to determine in I need to check for 2 or three arguments in the function. Below is my semi working code: function destroyer(arr) {
// Remove all the values
for (i=1;i < arr.length;i++){
arr = arr.filter(function(value){return value != arr[1]});
}
return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

'''
CamperBot
@camperbot
Sep 11 2015 18:16
:bulb: to format code use backticks! ``` more info
Lee Doyle
@ldoyle0
Sep 11 2015 18:16
This message was deleted
CamperBot
@camperbot
Sep 11 2015 18:16
:bulb: to format code use backticks! ``` more info
Lee Doyle
@ldoyle0
Sep 11 2015 18:17
This message was deleted
CamperBot
@camperbot
Sep 11 2015 18:17
:bulb: to format code use backticks! ``` more info
Lee Doyle
@ldoyle0
Sep 11 2015 18:18
This message was deleted
CamperBot
@camperbot
Sep 11 2015 18:18
:bulb: to format code use backticks! ``` more info
Rex Schrader
@SaintPeter
Sep 11 2015 18:18
@ldoyle0 The function you're looking for is Array.indexOf
@ldoyle0 those are backticks, nto single quotes
wiki format
CamperBot
@camperbot
Sep 11 2015 18:18

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

```js ⇦ Type 3 backticks, then type js or html and then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Rex Schrader
@SaintPeter
Sep 11 2015 18:18
@ldoyle0 Click through to the wiki for the location of the backtick on your keyboard
Lee Doyle
@ldoyle0
Sep 11 2015 18:19
@SaintPeter thanks im totally failing at this
CamperBot
@camperbot
Sep 11 2015 18:19
ldoyle0 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 577 | @saintpeter | http://www.freecodecamp.com/saintpeter
Lee Doyle
@ldoyle0
Sep 11 2015 18:20
function destroyer(arr) {
  // Remove all the values
  for (i=1;i < arr.length;i++){
    arr = arr.filter(function(value){return value != arr[1]}); 
  }
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
there we go haha
Rex Schrader
@SaintPeter
Sep 11 2015 18:22
@ldoyle0 ok, remember that the function may have one or more items to be destroyed. You need to use the arguments object to get those additiional args.
wiki js arguments
CamperBot
@camperbot
Sep 11 2015 18:23

:point_right: js arguments [wiki]

The arguments object is an array-like object (meaning that it looks like an array but it's not) that stores all of the arguments that you passed to a function and is proprietary to that function in particular. If you were to pass 3 arguments to a function, say storeNames(), those 3 arguments would be stored inside an object called arguments and it would look like this when we pass the arguments storeNames("Mulder", "Scully", "Alex Krycek") to our function:

  • First, we declare a function and make it return the arguments object.

    function storeNames() { return arguments; }
  • Then, when we execute that function with n arguments, 3 in this case, it will return the object to us and it will look like an array. We can convert it to an array, but more on that later...

    // If we execute the following line in the console:
    storeNames("Mulder", "Scully", "Alex Kryceck");
    // The output will be: ["Mulder", "Scully", "Alex Kryceck"]

If you want to know more about this, such as converting it to an array or the optimization problem that comes with using the slice() method and how to solve it, click on read more (Gitter Chat Only).

:pencil: read more about js arguments on the FCC Wiki

chicachicamji
@chicachicamji
Sep 11 2015 18:25
does anyone know how to access values associated with properties for the where art thou bonfire?
Rex Schrader
@SaintPeter
Sep 11 2015 18:26
@chicachicamji There are three way to access the property of an object:
1) obj.propertyname
2) obj['propertyname']
3) obj[variableWithAPropertyNameInIt]
@chicachicamji I think the 3rd is what you want.
chicachicamji
@chicachicamji
Sep 11 2015 18:28
@SaintPeter should that access the value associated with the property?
Rex Schrader
@SaintPeter
Sep 11 2015 18:28
@chicachicamji Yup
Oscar Lopez Guzman
@olopezg
Sep 11 2015 18:30

Hi guys!, I'm doing "Bonfire: Seek and Destroy" and I'm kind of stuck.
This is what i´ve done so far...

```
function destroyer(arr) {
var args = Array.prototype.slice.call(arguments);
console.log("arguments",args);

var result = arr;

for(var i = 0; i < args.length; i++){
for(var j = 0; j < arr.length; j++){
if(arr[j] === args[i]){
var index = result.indexOf(args[i])
result.splice(index, 1)
}
}
}

return result;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

blob
Karina Machado
@karinamachado
Sep 11 2015 18:30
Hi, I need do a app that get current location, I saw some tutorial at the web, but when the get only the city, not a adress.
someone did something like application.
?
Rex Schrader
@SaintPeter
Sep 11 2015 18:37
@olopezg The problem is that when you use splice to remove an index, the value of i or j may change relative to the array. You've basically changed the relative value of those indexes to skip over an element.
@karinamachado Google geolocation services - there is one built into modern browsers
Tirolês
@tiroles
Sep 11 2015 18:38
@olopezg Man, I just finished this one.... HAD to see the hint to finish... :(((( AND I still don't get the solution completly
specially the end of the code
I'm struggling to understand when to use "return"
Tirolês
@tiroles
Sep 11 2015 18:50
Guys... my head just hurt trying to understand the end of Seek and Destroy solution... Anyone could help me understand?
githard
@githard
Sep 11 2015 18:51
i'm struggling to debug a website issue, anyone want to help me out? :)
somehow i've completely broken it :(
Rex Schrader
@SaintPeter
Sep 11 2015 18:55
@tiroles Sure
@tiroles Share your code?
Tirolês
@tiroles
Sep 11 2015 18:56
function destroyer(arr) {
  // Remove all the values
 var args = Array.prototype.slice.call(arguments);
 args.splice(0,1); // return array [2,3] separa os argumentos
 return arr.filter(function(element){ //precisa retornar a função filter
  return args.indexOf(element) === -1; //escolhe os elementos do filtro, que são numerados pelo IndexOf
  });
   }
So, the last bit got me puzzled
Rex Schrader
@SaintPeter
Sep 11 2015 18:59
@tiroles ok, that's easy enough:
First you turn your arguments object into an array. THe first element is the array to scan.
Then you use .filter on that array. Filter runs a function you provide against every element of the array it is called on. If that function returns true, it keeps the element. If it returns false it gets rid of it.
By doing return args.indexOf(element) === -1, you're saying "If the index of element in args is 'not found' (-1), then say true (and keep that element)"
@tiroles indexOf searches an array for an element. If it finds it, it returns the first index. Since 0 is a valid index, indexOf returns -1 when it doesn't find it.
Tirolês
@tiroles
Sep 11 2015 19:00
Hummmmm holly hell man... @SaintPeter thanks!
CamperBot
@camperbot
Sep 11 2015 19:00
tiroles sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
Rex Schrader
@SaintPeter
Sep 11 2015 19:00
@tiroles Hope that helps. Gotta get.
CamperBot
@camperbot
Sep 11 2015 19:00
:star: 583 | @saintpeter | http://www.freecodecamp.com/saintpeter
Tirolês
@tiroles
Sep 11 2015 19:00
Totally
Rex Schrader
@SaintPeter
Sep 11 2015 19:00
:D :D
Tirolês
@tiroles
Sep 11 2015 19:01
I will kind of read your explanation a few more times and see if get into my brain the logic
hahahah
chicachicamji
@chicachicamji
Sep 11 2015 19:02
@SaintPeter i still dont understand the syntax for accessing the values of propertys
properties*
Juliano Rafael
@thefrontendwizard
Sep 11 2015 19:16
need some help here
anyone up?
Tom Lorimer
@Ellf
Sep 11 2015 19:40
Bonfire: Seek and Destroy
CamperBot
@camperbot
Sep 11 2015 19:40

:fire:Bonfire: Seek and Destroy :link:

function destroyer(arr) {
  // Remove all the values
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

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.

more info:  bf details | bf links | hint

Tom Lorimer
@Ellf
Sep 11 2015 19:40
hint
CamperBot
@camperbot
Sep 11 2015 19:40
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
georgiel
@georgiel
Sep 11 2015 20:06
is there a separate link on git for new task suggestions or is it just in issues?
mikeLirette
@mikeLirette
Sep 11 2015 20:09
Waypoint: Make Instances of Objects with a Constructor Function
mikeLirette
@mikeLirette
Sep 11 2015 20:19
Can anyone help with the above Waypoint?
Bill
@kirah1314
Sep 11 2015 20:22
@mikeLirette sure I can take a look. Paste your code?
mikeLirette
@mikeLirette
Sep 11 2015 20:24
var Car = function() {
   this.wheels = 4;
};

// Only change code below this line.
var myCar = new Car();

//Add the property "engines" to myCar, and make it a number.
Bill
@kirah1314
Sep 11 2015 20:27
@mikeLirette so you have to add a property engines to myCar
@mikeLirette you can use myCar.engines
mikeLirette
@mikeLirette
Sep 11 2015 20:30
@kirah1314 myCar.engines = 1;
Thanks! I've been reading on MDN to no avail, thank you
CamperBot
@camperbot
Sep 11 2015 20:30
mikelirette sends brownie points to @kirah1314 :sparkles: :thumbsup: :sparkles:
:star: 235 | @kirah1314 | http://www.freecodecamp.com/kirah1314
Danny Libin
@Daynil
Sep 11 2015 20:31
Hey, I'm trying to use a quotes api for the random quote machine zipline. I'm running into a problem I can't really figure out involving same-origin policy. I'm accessing the api from the script, and it's being blocked by the browser due to SOP, and I can't use jsonp since the api doesn't provide a jsonp response format.
Is there really no way around this other than using serverside script?
I felt like apis would be easier in web dev, turns out it's more complicated!
John McEnery
@leftfieldhero
Sep 11 2015 20:32
Waypoint: Target a Specific Child of an Element Using jQuery
anyone having issues with this?
$(".well:nth-child(2)").addClass("animated bounce");
});
Moisés Man
@moigithub
Sep 11 2015 20:33
any1 near -5 gmt doin non-profits ? or wanna do ?
Bhavesh Gupta
@BhaveshSGupta
Sep 11 2015 20:43
hey can any one help with css transition shorthand, does any one know a website which could append all shorthands!
jojacino
@jojacino
Sep 11 2015 20:52
@BhaveshSGupta I know a little, what do you need help with?
Jack Demynn
@infectiouscode
Sep 11 2015 20:57
Hey guys, I was wondering if anyone was available to lend me a hand on my code?
Bill
@kirah1314
Sep 11 2015 20:59
@leftfieldhero you need a space after well
Valon Haliti
@valonhaliti
Sep 11 2015 21:01
@infectiouscode I'm available, what do you need?
Jack Demynn
@infectiouscode
Sep 11 2015 21:02
I'm not sure how to add the id into the well here. It asks me to add the id of left and right well, but I dont know which one would be left or right? I tried both ways and it wouldnt process it
<div class="container-fluid">
  <h3 class="text-primary text-center">jQuery Playground</h3>
  <div class="row">
    <div class="col-xs-6">
      <div class="well">
        <button class="btn btn-default target"></button>
        <button class="btn btn-default target"></button>
        <button class="btn btn-default target"></button>
      </div>
    </div>
    <div class="col-xs-6">
      <div class="well">
        <button class="btn btn-default target"></button>
        <button class="btn btn-default target"></button>
        <button class="btn btn-default target"></button>
      </div>
    </div>
  </div>
</div>
Bill
@kirah1314
Sep 11 2015 21:04
@infectiouscode how did you add the id? what did you use?