These are chat archives for FreeCodeCamp/Help

17th
Sep 2015
Kevin McCann
@kmccn-org
Sep 17 2015 00:00
@efkar thank you
CamperBot
@camperbot
Sep 17 2015 00:00
kmccn-org sends brownie points to @efkar :sparkles: :thumbsup: :sparkles:
:star: 183 | @efkar | http://www.freecodecamp.com/efkar
chromuh
@chromuh
Sep 17 2015 00:04
could use some help
I am stuck on the waypoint manipulating arrays
specififcally using the .pop function
specifically*
i feel as though I am over thinking this situation
any help?
lol anyone?
Chocobowings
@chocobowings
Sep 17 2015 00:08
@chromuh Hey. you just need to use pop with myArray
chromuh
@chromuh
Sep 17 2015 00:08
@chocobowings so i keep putting it in as myArray.pop();
but its not completing the section
Chocobowings
@chocobowings
Sep 17 2015 00:08
@chromuh Can you paste your code
chromuh
@chromuh
Sep 17 2015 00:08
its saying I am missing something

// var numbers = [1,2,3];
// console.log(numbers); // logs [1,2,3]
// var removed = numbers.pop();
// console.log(numbers); // logs [1,2]
// console.log(removed); // logs 3

var myArray = ["John", 23, ["cat", 2]];
// Only change code below this line.

var removed = myArray; // This should be ["cat", 2] and myArray should now be ["John", 23]
myArray.pop();

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z);})(myArray, removed);

Juan Riquelme
@soulchainer
Sep 17 2015 00:09
find pasting code
CamperBot
@camperbot
Sep 17 2015 00:09
find code paste
nothing found
Chocobowings
@chocobowings
Sep 17 2015 00:09
@chromuh
var removed = myArray.pop();
chromuh
@chromuh
Sep 17 2015 00:09
aha
ok
Juan Riquelme
@soulchainer
Sep 17 2015 00:10
find paste code
CamperBot
@camperbot
Sep 17 2015 00:10
find paste code
nothing found
Chocobowings
@chocobowings
Sep 17 2015 00:10
@chromuh
var removed = myArray.pop(); // This should be ["cat", 2] and myArray should now be ["John", 23]
Juan Riquelme
@soulchainer
Sep 17 2015 00:10
well... It doesn't want to found it xD.
chromuh
@chromuh
Sep 17 2015 00:10
ok cool
the instructions weren't that clear to me
so its all in the same line
also @chocobowings how did you past the code like that? lol
Sebastian Hewelt
@sebhewelt
Sep 17 2015 00:11
This message was deleted
chromuh
@chromuh
Sep 17 2015 00:11
sorry I am 6 days into doing all this @chocobowings
Chocobowings
@chocobowings
Sep 17 2015 00:11
@chromuh
use ```
chromuh
@chromuh
Sep 17 2015 00:11
cool
thanks
CamperBot
@camperbot
Sep 17 2015 00:11
if you want to thank someone, put an @ before their name!
chromuh
@chromuh
Sep 17 2015 00:12
@chocobowings thanks
CamperBot
@camperbot
Sep 17 2015 00:12
chromuh sends brownie points to @chocobowings :sparkles: :thumbsup: :sparkles:
:star: 285 | @chocobowings | http://www.freecodecamp.com/chocobowings
Chocobowings
@chocobowings
Sep 17 2015 00:13
@chromuh Check the icons beside the text field on your chat window
@chromuh more specifically the m with an arrow pointing down
chromuh
@chromuh
Sep 17 2015 00:14
dope as fuck
thanks @chocobowings
CamperBot
@camperbot
Sep 17 2015 00:14
chromuh sends brownie points to @chocobowings :sparkles: :thumbsup: :sparkles:
:warning: chromuh already gave chocobowings points
Chocobowings
@chocobowings
Sep 17 2015 00:14
@chromuh If you get stuck don't be afraid to ask :)
Kevin McCann
@kmccn-org
Sep 17 2015 00:18
@soulchainer help format
help format
CamperBot
@camperbot
Sep 17 2015 00: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

jkirch
@jkirch
Sep 17 2015 00:20

I'm trying the title-case bonfire (capitalize each word)

function titleCase(str) {
   str = str.split(' ')

   for (i = 0; i<str.length ; i++) {
     d = str[i];

     d = d.charAt(0).toUpperCase + d.slice(1);
     str[i] = d;

   }
  str = str.join(' ');
   return str;


}

titleCase("I'm a little tea pot", "");

But I'm getting all sorts of weird code in the return. Is there an easier/better way to concatenate the charAt(0).toUpperCase with the rest of it that I'm missing?

Mateja Trifunovski
@Matko95
Sep 17 2015 00:21
@jkirch it's a propper way
Juan Riquelme
@soulchainer
Sep 17 2015 00:21
Don't worry, @kmccn-org : I already known Markdown pretty well from a long time ;). I just was trying to get the explanation for not repeating, because I already did it today a few times and is tiresome :þ. But thanks!
CamperBot
@camperbot
Sep 17 2015 00:21
soulchainer sends brownie points to @kmccn-org :sparkles: :thumbsup: :sparkles:
:star: 198 | @kmccn-org | http://www.freecodecamp.com/kmccn-org
chromuh
@chromuh
Sep 17 2015 00:22
damn this javascript section is slowing me down lol
jkirch
@jkirch
Sep 17 2015 00:22
I'm sorry @Matkos95, am I missing something? I don't understand.
chromuh
@chromuh
Sep 17 2015 00:22
stuck on the next waypoint
Mateja Trifunovski
@Matko95
Sep 17 2015 00:23
@jkirch you didn't define d anywhere
chromuh
@chromuh
Sep 17 2015 00:23
var ourArray = ["Stimpson", "J", ["cat"]];
ourArray.pop();
ourArray.push(["happy", "joy"]);
// ourArray now equals ["Stimpson", "J", ["happy", "joy"]].

var myArray = ["John", 23, ["cat", 2]];
myArray.push("dog", 3);

// Add a ["dog", 3] to the end of myArray using push().
// Only change code below this line.


// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);
well thats how i put it at least
Chocobowings
@chocobowings
Sep 17 2015 00:24
@jkirch And also you should lower case the string before
DTing
@dting
Sep 17 2015 00:24
@jkirch your code works you just need to lowercase the string
Mateja Trifunovski
@Matko95
Sep 17 2015 00:24
@jkirch and when you do str.split(" ") you need to save it in an array
DTing
@dting
Sep 17 2015 00:24
its usually bad practice to use global variables, d and i in your case
Chocobowings
@chocobowings
Sep 17 2015 00:26
@dting Second that. @jkirch If you don't define a variable using var, Javascript will define it as a global variable.
DTing
@dting
Sep 17 2015 00:26
You can either lowercase your entire string before spliting or you can lowercase each d.slice(1)
jkirch
@jkirch
Sep 17 2015 00:27
thank you @Matko95 @dting @chocobowings
CamperBot
@camperbot
Sep 17 2015 00:27
jkirch sends brownie points to @matko95 and @dting and @chocobowings :sparkles: :thumbsup: :sparkles:
:star: 286 | @chocobowings | http://www.freecodecamp.com/chocobowings
:star: 314 | @matko95 | http://www.freecodecamp.com/matko95
:star: 1193 | @dting | http://www.freecodecamp.com/dting
Chocobowings
@chocobowings
Sep 17 2015 00:28

@chromuh

myArray.push("dog", 3);

you should be pushing an array

["dog",3]
@chromuh
// Add a ["dog", 3] to the end of myArray using push().
Dave Adams
@dbwadams
Sep 17 2015 00:29
I'm having trouble getting the code in the waypoint "Learn how to Script Tags and Document Ready Work. No errors, it just doesn't do anything when I click "enter". I've gone over the code many times after resetting the code. I can't figure it out.

<script>
$(document).ready(function() {

});
</script>

<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">
<h4>#left-well</h4>
<div class="well" id="left-well">
<button class="btn btn-default target" id="target1">#target1</button>
<button class="btn btn-default target" id="target2">#target2</button>
<button class="btn btn-default target" id="target3">#target3</button>
</div>
</div>
<div class="col-xs-6">
<h4>#right-well</h4>
<div class="well" id="right-well">
<button class="btn btn-default target" id="target4">#target4</button>
<button class="btn btn-default target" id="target5">#target5</button>
<button class="btn btn-default target" id="target6">#target6</button>
</div>
</div>
</div>
</div>

Chocobowings
@chocobowings
Sep 17 2015 00:30
@dbwadams
<script>
$(document).ready(function() {

});
</script>
<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">
<h4>#left-well</h4>
<div class="well" id="left-well">
<button class="btn btn-default target" id="target1">#target1</button>
<button class="btn btn-default target" id="target2">#target2</button>
<button class="btn btn-default target" id="target3">#target3</button>
</div>
</div>
<div class="col-xs-6">
<h4>#right-well</h4>
<div class="well" id="right-well">
<button class="btn btn-default target" id="target4">#target4</button>
<button class="btn btn-default target" id="target5">#target5</button>
<button class="btn btn-default target" id="target6">#target6</button>
</div>
</div>
</div>
</div>
@dbwadams your code works for me.
Peggy Wiltz
@PeggyWiltz
Sep 17 2015 00:31
Hi folks. I'm working on Bonfire Seek and Destroy. I did it without using filter but it works according to the code that's returned. However, the tests don't pass. Can anyone take a look and see if you can see what I'm doing wrong?
Dave Adams
@dbwadams
Sep 17 2015 00:31
Hmmm . . .
Peggy Wiltz
@PeggyWiltz
Sep 17 2015 00:31

'''function destroyer(arr) {
// Remove all the values
var argCount = arguments.length;
var argArray = [];

for (var i = 1; i < argCount - 1; i++) {
argArray.push(arguments[i]);
}
for (var j = arr.length; j >= 0; j--) {
for (var k = 0; k < argArray.length; k++) {
if (arr[j] == argArray[k]) {
arr.splice(j, 1);
}
}
}
return arr;
}

destroyer([2, 3, 2, 3], 2, 3, "");'''

CamperBot
@camperbot
Sep 17 2015 00:31
:bulb: to format code use backticks! ``` more info
chromuh
@chromuh
Sep 17 2015 00:31

@chocobowings

i think there is something I am not comprehending

Chocobowings
@chocobowings
Sep 17 2015 00:32
@dbwadams Did you try pressing ctrl + enter
Peggy Wiltz
@PeggyWiltz
Sep 17 2015 00:32

```function destroyer(arr) {
// Remove all the values
var argCount = arguments.length;
var argArray = [];

for (var i = 1; i < argCount - 1; i++) {
argArray.push(arguments[i]);
}
for (var j = arr.length; j >= 0; j--) {
for (var k = 0; k < argArray.length; k++) {
if (arr[j] == argArray[k]) {
arr.splice(j, 1);
}
}
}
return arr;
}

destroyer([2, 3, 2, 3], 2, 3, "");```

Hmm, can't format correctly, sorry.
Dave Adams
@dbwadams
Sep 17 2015 00:32
Yep. Thanks @chocobowings. I will try another browser.
CamperBot
@camperbot
Sep 17 2015 00:32
dbwadams sends brownie points to @chocobowings :sparkles: :thumbsup: :sparkles:
:star: 287 | @chocobowings | http://www.freecodecamp.com/chocobowings
DTing
@dting
Sep 17 2015 00:32
@chromuh in the example you can see that they push an array literal
ourArray.push(["happy", "joy"]);
your code doesnt have the []
so you are callin push with 2 arguments.
they want you to call push with a single argument with 2 elements
Victor Hernandez
@Theviajerock
Sep 17 2015 00:33
@Theviajerock
Hi people... i need some help : P
I am in the Zipline: Build a Personal Portfolio Webpage
Until now.. i have this:
http://codepen.io/Theviajerock/pen/dYYBZa
But when i reduce the size of the screen... the top navbar cover my first div element :(
can somebody help me please? i can not understand why this happen.
I am stucked in there.
chromuh
@chromuh
Sep 17 2015 00:34
so when I have done that below the var declaration like it doesn't read or maybe I am writing it incorrectly
var ourArray = ["Stimpson", "J", ["cat"]];
ourArray.pop();
ourArray.push(["happy", "joy"]);
// ourArray now equals ["Stimpson", "J", ["happy", "joy"]].

var myArray = ["John", 23, ["cat", 2]]; 
myArray.push(["dog", 3]);

// Add a ["dog", 3] to the end of myArray using push().
// Only change code below this line.


// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);
Dave Adams
@dbwadams
Sep 17 2015 00:35
My code worked in Chrome. I was using the new Microsoft Edge previously.
chromuh
@chromuh
Sep 17 2015 00:36
oh wait
i think i know whats going on
it also wants me to take off the end with .pop()
lol
thanks @dting @chocobowings
CamperBot
@camperbot
Sep 17 2015 00:37
chromuh sends brownie points to @dting and @chocobowings :sparkles: :thumbsup: :sparkles:
:warning: chromuh already gave chocobowings points
:star: 1194 | @dting | http://www.freecodecamp.com/dting
Peggy Wiltz
@PeggyWiltz
Sep 17 2015 00:47
var argArray = [];
Robert Richey
@0x0936
Sep 17 2015 00:49
```javascript
//code
```
Peggy Wiltz
@PeggyWiltz
Sep 17 2015 00:51
Going to try to do it right this time...
function destroyer(arr) {
  // Remove all the values
  var argCount = arguments.length;
  var argArray = [];

  for (var i = 1; i < argCount - 1; i++) {
    argArray.push(arguments[i]);
  }
  for (var j = arr.length; j >= 0; j--) {
    for (var k = 0; k < argArray.length; k++) {
      if (arr[j] == argArray[k]) {
        arr.splice(j, 1);
      }
    }
  }
  return arr;
}

destroyer([1, 2, 3, 2, 3, 6], 2, 3, "");
Above is my code for the Seek and Destroy Bonfire problem. It works in jsFiddle and also returns the correct value in the little code window on the page under the test runner button, but none of the tests pass. Is this a bug? Can anyone figure out what I did wrong?
I appreciate any help anyone can give me.
Joshua Travis
@jktravis
Sep 17 2015 00:53
bf destroyer
CamperBot
@camperbot
Sep 17 2015 00:53
Sorry, can't find a bonfire called destroyer. [ Check the map? ]
Victor Hernandez
@Theviajerock
Sep 17 2015 00:54
Zipline: Build a Personal Portfolio Webpage
Joshua Travis
@jktravis
Sep 17 2015 00:54
bf destroy
CamperBot
@camperbot
Sep 17 2015 00:54

: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

Joshua Travis
@jktravis
Sep 17 2015 00:55
bf details
CamperBot
@camperbot
Sep 17 2015 00:55

: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.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
Peggy Wiltz
@PeggyWiltz
Sep 17 2015 00:56
That's the one.
Joshua Travis
@jktravis
Sep 17 2015 00:58
@PeggyWiltz So, if you run it with [1, 2, 3, 1, 2, 3], 2, 3 as the args, it returns [1,1] in your fiddle?
Robert Richey
@0x0936
Sep 17 2015 00:59
@PeggyWiltz change condition in first for loop to i < argCount; You're starting at index 1 and want to go to the last index. Then change the initialization in the second for loop to var j = arr.length - 1; because arr[arr.length] is one past the last element of arr.
Peggy Wiltz
@PeggyWiltz
Sep 17 2015 00:59
Yes, correct. In my fiddle and also in the actual codecamp window. Can I do a screenshot here?
Robert Richey
@0x0936
Sep 17 2015 01:00
function destroyer(arr) {
  // Remove all the values
  var argCount = arguments.length;
  var argArray = [];
  for (var i = 1; i < argCount; i++) {
    argArray.push(arguments[i]);
  }
  for (var j = arr.length - 1; j >= 0; j--) {
    for (var k = 0; k < argArray.length; k++) {
      if (arr[j] == argArray[k]) {
        arr.splice(j, 1);
      }
    }
  }
return arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3); // output: [1, 1]
Peggy Wiltz
@PeggyWiltz
Sep 17 2015 01:00
@jktravis yes, you are correct. It returns the right values.
Joshua Travis
@jktravis
Sep 17 2015 01:01
@PeggyWiltz I was able to get away with just using the splice() on the arguments array and filter on the passed in array.
Peggy Wiltz
@PeggyWiltz
Sep 17 2015 01:02
@0x0936 I tried your suggestions and no change. I actually already have i < argCount; in the first loop
@jktravis Lots of ways to do it. My question is, if it's returning the correct values, why don't the tests pass?
Robert Richey
@0x0936
Sep 17 2015 01:03
@PeggyWiltz in the code you posted, it shows as i < argCount - 1
Peggy Wiltz
@PeggyWiltz
Sep 17 2015 01:04
@0x0936 You are right, my bad. That was the problem. Still don't understand why it was showing the correct values returned though. Anyway, it worked with that small change. On to the next. Thank you both @jktravis and @0x0936
CamperBot
@camperbot
Sep 17 2015 01:04
peggywiltz sends brownie points to @0x0936 and @jktravis and @0x0936 :sparkles: :thumbsup: :sparkles:
:star: 166 | @0x0936 | http://www.freecodecamp.com/0x0936
:star: 166 | @0x0936 | http://www.freecodecamp.com/0x0936
:star: 204 | @jktravis | http://www.freecodecamp.com/jktravis
IgnisCerebrum
@IgnisCerebrum
Sep 17 2015 01:40
I'm really, really lost here, guys....
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  h2 {
    font-family: Lobster, Monospace;
  }

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

<div class="container-fluid">
  <div class="row">
    <div class="col-xs-8">
      <h2 class="text-primary text-center">CatPhotoApp</h2>
    </div>
    <div class="col-xs-4">
      <a href="#"><img class="img-responsive thick-green-border" src="https://bit.ly/fcc-relaxing-cat"></a>
    </div>
  </div>
  <img src="http://bit.ly/fcc-running-cats" class="img-responsive">
  <div class="row">
    <div class="col-xs-4">
<div class="row"><div class="col-xs-6"><button class="btn btn-block btn-primary"><i class="fa fa-thumbs-up"></i> Like</button></div>
      </div></div>

     <div class="col-xs-4"> <button class="btn btn-block btn-info"><i class="fa fa-info-circle"></i> Info</button></div>
  </div>
    <div class="col-xs-4">
      <button class="btn btn-block btn-danger"><i class="fa fa-trash"></i> Delete</button></div></div>

</div>
  <p>Things cats <span class="text-danger">love:</span></p>
  <ul>
    <li>cat nip</li>
    <li>laser pointers</li>
    <li>lasagna</li>
  </ul>
  <p>Top 3 things cats hate:</p>
  <ol>
    <li>flea treatment</li>
    <li>thunder</li>
    <li>other cats</li>
  </ol>
  <form action="/submit-cat-photo">
    <label><input type="radio" name="indoor-outdoor"> Indoor</label>
    <label><input type="radio" name="indoor-outdoor"> Outdoor</label>
    <label><input type="checkbox" name="personality"> Loving</label>
    <label><input type="checkbox" name="personality"> Lazy</label>
    <label><input type="checkbox" name="personality"> Crazy</label>
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
  </form>
</div>
This is what I'm supposed to do: Nest all of your radio buttons within a <div class="row"> element. Then nest each of them within a <div class="col-xs-6"> element.
Michal
@michalzareba0001
Sep 17 2015 01:58
Get stuck on Bonfire:

This: function palindrome(str) {
str=str.toLowerCase();
str=str.replace(/ /g, '');
str=str.replace(/./g, '');
str=str.replace(/\,/g, '');
str=str.replace(/_/g, '-');
str=str.replace(/(/g, 'a');
str=str.replace(/)/g, 'a');
str1 = str.split('').reverse().join('');
str1=str1.toLowerCase();

if (str1==str){
return true;}
else {
return false;
}
}

palindrome("eye");

should return: assert(palindrome("0_0 (: /-\ :) 0-0") === true, '"0_0 (: /-\ :) 0-0" should return true.');"0_0 (: /-\ :) 0-0" should return true.
Why it's not working???
Also how to put all str.replace in one line?
APM
@APMerchant
Sep 17 2015 02:01
I am stuck in bonfire: title case a sentence...my program is giving the required output but the ctrl+ enter does not seem to work
Rex Schrader
@SaintPeter
Sep 17 2015 02:05
@APMerchant Just click the "run" button
APM
@APMerchant
Sep 17 2015 02:08
@michalzareba0001 try this
str.replace(/[., _]/g,'')
@SaintPeter been doing that too...output comes as required, but still its not registering that I have completed the challenge
Rex Schrader
@SaintPeter
Sep 17 2015 02:10
@APMerchant Copy your code, refresh the page, paste your code back in. And/or click the "reset code" button and paste your code back in.
APM
@APMerchant
Sep 17 2015 02:10
let me try that once more...did it once

@SaintPeter not helping...
here is my code...

function titleCase(str) {
str = str.toLowerCase();
sentence = '';
var arrayOfWords =str.split(' ');
var numberOfWords = arrayOfWords.length;
for(var i =0; i <numberOfWords; i++)
{
sentence += arrayOfWords[i].charAt(0).toUpperCase();
sentence += arrayOfWords[i].substr(1).toLowerCase();
sentence += ' ';
}
str = sentence;
return str;
}

titleCase("I'm a little tea pot", "");

Rex Schrader
@SaintPeter
Sep 17 2015 02:13
@APMerchant I'm seeing it failing a bunch of tests
APM
@APMerchant
Sep 17 2015 02:14
yep i see the same thing as u @SaintPeter
but see the output...u should see ' I'm A Little Tea Pot'
thats the required output
Rex Schrader
@SaintPeter
Sep 17 2015 02:15
@APMerchant Part of the problem is that you have not defined sentance as a variable.
APM
@APMerchant
Sep 17 2015 02:16
ok, tried that..still no change
Rex Schrader
@SaintPeter
Sep 17 2015 02:16
@APMerchant Secondly, you're appending a space to the end of the sentance where there should be none.
 " I'm A Little Tea Pot "
APM
@APMerchant
Sep 17 2015 02:16
oh yes, thats a good one
Rex Schrader
@SaintPeter
Sep 17 2015 02:16
@APMerchant Also, maybe putting a leading space?
rbunz
@rbunz08
Sep 17 2015 02:17
I have put an anchor tag in my html and it is automatically styling it like a link??
Rex Schrader
@SaintPeter
Sep 17 2015 02:17
@rbunz08 Anchor tags should not have an href element
rbunz
@rbunz08
Sep 17 2015 02:17
mine doesnt...
thats why im confused lol
Rex Schrader
@SaintPeter
Sep 17 2015 02:18
@APMerchant I modified to code to remove the leading and trailing spaces and it passed all tests.
@rbunz08 Is this on Codepen? If so, share a link.
APM
@APMerchant
Sep 17 2015 02:18
thats it @SaintPeter solved it by a simple if statement...
if (i<numberOfWords -1) sentence += ' '; thanks @SaintPeter
CamperBot
@camperbot
Sep 17 2015 02:18
apmerchant sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 638 | @saintpeter | http://www.freecodecamp.com/saintpeter
Mowgli418
@Mowgli418
Sep 17 2015 02:19
This message was deleted
APM
@APMerchant
Sep 17 2015 02:19
yes you could do the same with trim statement too
Rex Schrader
@SaintPeter
Sep 17 2015 02:21
@rbunz08 ok, short answer: Don't put anything inside the anchor tag - it'll still work just fine. Long answer read this article here about styling tags
@rbunz08 so:
<a name="whateverYouLike"></a>
rbunz
@rbunz08
Sep 17 2015 02:23
@SaintPeter Yea ok!! that works for now!!
@SaintPeter thanks!
CamperBot
@camperbot
Sep 17 2015 02:24
rbunz08 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 639 | @saintpeter | http://www.freecodecamp.com/saintpeter
Jacob Jamell
@jjamell
Sep 17 2015 02:32
ok, I've hit a snag on Bonfire: No repeats please
expect(permAlone('aabb')).to.equal(8); expected 13 to equal 8
it's pretty much the same all the way down, not reducing enough even though I'm catching some repeats
bf no repeats
CamperBot
@camperbot
Sep 17 2015 02:35

:fire:Bonfire: No repeats please :link:

function permAlone(str) {
  return str;
}

permAlone('aab');

Return the number of total permutations of the provided string that don't have repeated consecutive letters.

more info:  bf details | bf links | hint

Rex Schrader
@SaintPeter
Sep 17 2015 02:35
@jjamell Share your code?
Jacob Jamell
@jjamell
Sep 17 2015 02:35
function permAlone(str) {
  permutations = [];
  hasRepeat = /(.)\1/g;
  allRepeats = /^(.)\1{1,}$/gm;

  if(allRepeats.test(str)) return 0; //don't bother, return early.

  heapsPermute(str.split(''), (output)=>permutations.push(output.join('')));

  return permutations.filter((item)=>!hasRepeat.test(item)).length -1;

  function heapsPermute(array, output, n) {
    n = n || array.length; // set n default to array.length
    if (n === 1)  output(array);
    else
      for (var i=1; i<=n; i+=1) {
        heapsPermute(array, output, n-1);
        j = (n % 2)?1:i;
        swap(array, j-1, n-1);
      }
  }

  function swap(array, pos1, pos2) {
    var temp = array[pos1];
    array[pos1] = array[pos2];
    array[pos2] = temp;
  }
}

permAlone('aabb');
Rex Schrader
@SaintPeter
Sep 17 2015 02:37
This message was deleted
Jacob Jamell
@jjamell
Sep 17 2015 02:38
I may have messed something up in either the heaps algorithm or the hasRepeat regex
Rex Schrader
@SaintPeter
Sep 17 2015 02:38
@jjamell I don't recognize this syntax at all:
(item)=>!hasRepeat.test(item)
Jacob Jamell
@jjamell
Sep 17 2015 02:38
@SaintPeter It's an ES6 shorthand for an anonymous function
Rex Schrader
@SaintPeter
Sep 17 2015 02:38
@jjamell As for heaps, just add some console.log statements and check your output
@jjamell That works? We support ES6?
@jjamell I'm not sure that FCC does.
Arooj
@aroojahmad
Sep 17 2015 02:39
I don’t know how to get past most of the Bonfire exercises; anyone looking to pair up tonight?
Jacob Jamell
@jjamell
Sep 17 2015 02:39
@SaintPeter It runs. I've used it in many of my bonfire solutions. It's executing in the browser, right? If your browser can do it, it will pass.
Rex Schrader
@SaintPeter
Sep 17 2015 02:39
@jjamell I guess so.
@jjamell I don't think I can help you debug this, I can hardly read it.
Jacob Jamell
@jjamell
Sep 17 2015 02:40
@SaintPeter I'm counting up the number of permutations generated and they pretty much line up with the math
@SaintPeter yeah, sorry man, it's hard to make algorithms like this readable. I don't see the point of this exercise
J
@newb2programming
Sep 17 2015 02:42
I cannot get this to work everything is correct minus the color
Rex Schrader
@SaintPeter
Sep 17 2015 02:42
@jjamell I'm kinda thinking you're beyond it at this point. None of these bonfires are especially challenging if you have programming experience.
J
@newb2programming
Sep 17 2015 02:42
I entered the corect color and it wont show
<style>h2 {color :blue;} CatPhotoApp</h2></style>
Jacob Jamell
@jjamell
Sep 17 2015 02:44
@SaintPeter I'll just try messing with the regex test and see if it changes the number
Bill
@kirah1314
Sep 17 2015 02:44
@newb2programming the h2 should be <h2>
@newb2programming or </h2> should be removed
J
@newb2programming
Sep 17 2015 02:47
I tried both and still no rsult
is the entire code string wrong?
Jacob Jamell
@jjamell
Sep 17 2015 02:54
whatever. bf no repeats is garbage
Bill
@kirah1314
Sep 17 2015 02:56
@newb2programming do you have the waypoint link?
@newb2programming try removing CatPhotoApp</h2>
Mowgli418
@Mowgli418
Sep 17 2015 02:58
Screen Shot 2015-09-16 at 10.56.17 PM.png
hey. can anyone take a peek at this and tell me where I keep going wrong... I've been banging not his code for hours and am getting delirious...
It returns correct answers for everything except:
"almostomla"
"My age is 0, 0 si ega ym."
DJ
@qualitymanifest
Sep 17 2015 02:58
@Mowgli418 do you wanna post the code as text so we can try testing it
Mowgli418
@Mowgli418
Sep 17 2015 02:59

@qualitymanifest
function palindrome(str) {

var str2 = str.toLowerCase();
var str3 = str2.replace(/[,.] /g, '');
var strfinal = str3.replace(/\s/g, " ")
var str2reverse = strfinal.split('').reverse().join('');

var x = 0;
var len = strfinal.length;

for (i=0; i<=len; ) //length of clean string
{
if (strfinal[i] === str2reverse[i])
{i++;
return true;}
else
{break;}
}

return false;

}

palindrome("eye");

Farhad ali
@alifarhad
Sep 17 2015 03:02
that's huge @Mowgli418
DJ
@qualitymanifest
Sep 17 2015 03:05
yeah there's a lot of unnecessary lines and no indentation... but i'm trying to figure it out
Arsalan Sabir
@aayanqazi
Sep 17 2015 03:07
I Need Help :(
Mowgli418
@Mowgli418
Sep 17 2015 03:07
@alifarhad
thanks... I made it myself :worried:
CamperBot
@camperbot
Sep 17 2015 03:07
mowgli418 sends brownie points to @alifarhad :sparkles: :thumbsup: :sparkles:
:star: 195 | @alifarhad | http://www.freecodecamp.com/alifarhad
Alexander Schuneman
@AxSch
Sep 17 2015 03:07
@aayanqazi on what?
@aayanqazi You really shouldn’t post in all rooms like that
Arsalan Sabir
@aayanqazi
Sep 17 2015 03:09
I am working on portfolio personal page and i made a first page my problem is that when i minimize my browser size so my navigational bar collapse :(
Alexander Schuneman
@AxSch
Sep 17 2015 03:09
code? and what language is it related too?
because you couldn’t you use bootstrap?
Arsalan Sabir
@aayanqazi
Sep 17 2015 03:11
yeah bootstrap
Farhad ali
@alifarhad
Sep 17 2015 03:11
if you still need help for that, I could PM you @Mowgli418
rbunz
@rbunz08
Sep 17 2015 03:11
I have put in anchors so that when you click my navigation it brings you to a part of a webpage. However it brings it to the top of the page so that it is under the navigation bar. I have tried putting the navigation bar in the <head> I have also tried to give all my anchors the class of anchor but none of them are responding to it
Mowgli418
@Mowgli418
Sep 17 2015 03:12
@alifarhad plz do
@alifarhad thanks :)
CamperBot
@camperbot
Sep 17 2015 03:12
mowgli418 sends brownie points to @alifarhad :sparkles: :thumbsup: :sparkles:
:warning: mowgli418 already gave alifarhad points
DJ Runas
@djrunas
Sep 17 2015 03:12
help format
CamperBot
@camperbot
Sep 17 2015 03:12

: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

rbunz
@rbunz08
Sep 17 2015 03:13
nvm it suddenly decided to work...
DJ Runas
@djrunas
Sep 17 2015 03:14
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments);

  function destroy(value) {
    for (var i = 0; i < arr.length; i++) {
      if (value === arr[i]) {
        return true;
      } else {
        return false;
      }
    }
  }
  return arr.filter(destroy);
}

destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3);
Hello everyone! So, I’m trying to understand why this destroys the value 5 in the array as well.
DJ
@qualitymanifest
Sep 17 2015 03:19
@djrunas i don't have time to look at it now but i'd strongly suggest you go to the suggested link in that for "arguments object"
DJ Runas
@djrunas
Sep 17 2015 03:20
Reading up on it right now, @qualitymanifest :)
Trying to understand exactly what it does.
DJ
@qualitymanifest
Sep 17 2015 03:20
cool. takes a minute to understand but it's worth it. test it out in various ways with console.log
DJ Runas
@djrunas
Sep 17 2015 03:21
Will do! Thanks @qualitymanifest
CamperBot
@camperbot
Sep 17 2015 03:21
djrunas sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 215 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
OverTheNeptune
@OverTheNeptune
Sep 17 2015 03:21

@Mowgli418 Printing strFinal to the console shows "my age is 00 si ega ym." in the case of "My age is 0, 0 si ega ym." Your problem there is the '.' that's remaining at the end of the string.

I guess that doesn't tell you how to fix it, but at least gives you an idea of what to look at.

@AxSch
Philip Warkentien II
@warkentien2
Sep 17 2015 03:25
@aayanqazi did you want your button text underlined? Great initial design choices!
Hans van Riet
@hansinla
Sep 17 2015 03:25
@aayanqazi I would compress the background image, it takes a really long time to load.
Arsalan Sabir
@aayanqazi
Sep 17 2015 03:26
SO What i should do ?
@warkentien2 Btw Am New ... and this is my first web :/
@hansinla so what is solution ?
Philip Warkentien II
@warkentien2
Sep 17 2015 03:32
@aayanqazi for the underline. first add btn class to all your buttons. then in css .btn { text-decoration: none; }
Farhad ali
@alifarhad
Sep 17 2015 03:35
I'm sure it's already eaten my 400mb @hansinla xD
Philip Warkentien II
@warkentien2
Sep 17 2015 03:35
@aayanqazi about your image: it's a 4mb 3000x3000 photo. use photo editing software. like (gimp, which is free)
and resize, also save it in a much lower resolution (if needed) for web ppl normally use 72ppi
the size.. could have 1080p height. unless you're aiming for a 4K screen. it should be cristal clear elsewhere
Arsalan Sabir
@aayanqazi
Sep 17 2015 03:36
Ok thanks @warkentien2
CamperBot
@camperbot
Sep 17 2015 03:36
aayanqazi sends brownie points to @warkentien2 :sparkles: :thumbsup: :sparkles:
:star: 290 | @warkentien2 | http://www.freecodecamp.com/warkentien2
Arsalan Sabir
@aayanqazi
Sep 17 2015 03:36
and give me idea about navigational bar shrink in small size window
Jacob Jamell
@jjamell
Sep 17 2015 03:39
ok, I figured out that my regex is not working correctly for some reason. /(.)\1/g should work just fine to find repeating characters. Works on Regexr, doesn't work in my own code.
Philip Warkentien II
@warkentien2
Sep 17 2015 03:39
@aayanqazi research @media css for different displays due to screen size. and drop down navbar for the rest. I don't have any examples now. good luck
Mowgli418
@Mowgli418
Sep 17 2015 03:40
@OverTheNeptune
hey Neptune... Can you write me a quick demo on how to use console.log here?
like how did you make that print
OverTheNeptune
@OverTheNeptune
Sep 17 2015 03:41

@Mowgli418 console.log(strFinal);

or console.log("whatever you want to print here");

Mowgli418
@Mowgli418
Sep 17 2015 03:43
@OverTheNeptune
:/ Sorry I'm a dunce...
But what am I looking for? Like I still get the true/false in my regular console, but am not sure where you're looking to get that readout
DJ
@qualitymanifest
Sep 17 2015 03:44
@Mowgli418 what browser are you using?
Mowgli418
@Mowgli418
Sep 17 2015 03:44
@qualitymanifest
@qualitymanifest safari
OverTheNeptune
@OverTheNeptune
Sep 17 2015 03:45
@Mowgli418 I was running your code here: https://repl.it
DJ
@qualitymanifest
Sep 17 2015 03:46
ah... that i'm not so familiar with. most browsers have a "developer tools" section that will open up a window on the right side of the screen and can display javascript console.logs
repl.it is really useful too
Mowgli418
@Mowgli418
Sep 17 2015 03:46
ahhhh.. thanks guys :)
CamperBot
@camperbot
Sep 17 2015 03:46
if you want to thank someone, put an @ before their name!
chrome browser provides a really easy way to access it: ctrl+shift+i. i know i'm getting off track from your problem but this is a very important tool
Mowgli418
@Mowgli418
Sep 17 2015 03:52
no no!
Off-track me away.
I'm drowning :) All directions are appreciated
OverTheNeptune
@OverTheNeptune
Sep 17 2015 03:58
@Mowgli418 Your regex isn't catching the period. They have a special use in defining regular expression. In order to match it, you'll need to use /[,\. ]/g. This will find matches for commas, periods, and spaces. The \ before the period means that you are actually looking for a period character.
Mowgli418
@Mowgli418
Sep 17 2015 04:03
@OverTheNeptune :) :) thanks!!!
That's what I've been lacking... Now I've only got one broken test
CamperBot
@camperbot
Sep 17 2015 04:03
mowgli418 sends brownie points to @overtheneptune :sparkles: :thumbsup: :sparkles:
:star: 192 | @overtheneptune | http://www.freecodecamp.com/overtheneptune
OverTheNeptune
@OverTheNeptune
Sep 17 2015 04:04
@Mowgli418 No problem. Guessing your final test is failing?
Mowgli418
@Mowgli418
Sep 17 2015 04:05
No, actually... that one's running fine...
It's the almostomla that's failing
Farhad ali
@alifarhad
Sep 17 2015 04:07
this piece of regex [^a-z?1-9] for the palindrome problem works too xD @OverTheNeptune
they updated the problem and made it even more difficult to pass! first I could get away with something as simpler as `str.replace(/\W/g/, "")'
DJ Runas
@djrunas
Sep 17 2015 04:10
If you’re having trouble with your regular expression here is an excellent interactive site that explains them wonderfully! http://regexone.com/
@Mowgli418
Farhad ali
@alifarhad
Sep 17 2015 04:11
and here is the equally excellent site that helps you play around regex http://rubular.com/
DJ Runas
@djrunas
Sep 17 2015 04:11
That’s if you’re still having trouble! But, people have already posted some wonderful pieces of regex in here already :)
Feel free to use those :P
OverTheNeptune
@OverTheNeptune
Sep 17 2015 04:11
@alifarhad /[\W|_]/g is where I ended up. The underscore was what gave me problems.
DJ Runas
@djrunas
Sep 17 2015 04:13
^
That’s what caught me off-guard as well.
Farhad ali
@alifarhad
Sep 17 2015 04:13
haha @OverTheNeptune I was first going with [^a-z] but it would get stumped on assert(palindrome("1 eye for of 1 eye.") D:
coz there's bloody digits in there D:
DJ Runas
@djrunas
Sep 17 2015 04:14
I’m having trouble with the seek and destroy bonfire though.
Farhad ali
@alifarhad
Sep 17 2015 04:14
@djrunas it had me sweating for a whole day too
don't feel bad :
Bill
@kirah1314
Sep 17 2015 04:15
@djrunas how's your code look like?
Farhad ali
@alifarhad
Sep 17 2015 04:15
have you read up on arguments object in the helper link thou ? @djrunas I first dismissed it for regular arguments in any function, but turned out it's actually a whole damn another thing D: give it a ready over MDN
DJ Runas
@djrunas
Sep 17 2015 04:15
Oh, I read through it. Just not clicking :)
I’m sure I probably just need to sleep it over.
That’s usually the case.
But, so far, I have this:
function destroyer(arr) {

  // Turns the arguments into an array
  var args = Array.prototype.slice.call(arguments, 1);

  // Takes the values in the first argument and removes them
  // if they are the same value as any other arguments
  function destroy(args) {
    for (var i = 0; i < arr.length; i++) {
      if (arr[i] === args) {
        return true;
      } else {
        return false
      }  
    }
  }

  return arr.filter(destroy);
}

destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3);
OverTheNeptune
@OverTheNeptune
Sep 17 2015 04:16
@djrunas Had problems with that too. The logic was simple enough, but working with arguments didn't always work as expected.
xkalae
@xkalae
Sep 17 2015 04:17
@djrunas Thanks for the regular expressions link! Going through the site now. :)
CamperBot
@camperbot
Sep 17 2015 04:17
xkalae sends brownie points to @djrunas :sparkles: :thumbsup: :sparkles:
:star: 199 | @djrunas | http://www.freecodecamp.com/djrunas
DJ Runas
@djrunas
Sep 17 2015 04:17
Maybe I’m just tired, but the code in my filter callback function is probably wrong.
Oh, you’re welcome, @xkalae !
Farhad ali
@alifarhad
Sep 17 2015 04:17
it seems just fine. which tests are you failing with this ? @djrunas
DJ Runas
@djrunas
Sep 17 2015 04:17
It helped me a lot with the palindrome bonfire.
CamperBot
@camperbot
Sep 17 2015 04:17
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
DJ Runas
@djrunas
Sep 17 2015 04:18
Uh, I’m having trouble with all of the tests.
Aside from the first one.
For this array, I’m returning [1, 1].
Bill
@kirah1314
Sep 17 2015 04:18
@djrunas you have to use filter like this arr.filter(function(element)
DJ Runas
@djrunas
Sep 17 2015 04:18
When I should be returning [1, 5, 1]
Bill
@kirah1314
Sep 17 2015 04:18
add the function
Tracy Mazelin
@tracymazelin
Sep 17 2015 04:19
This is a simple question but how do I target the top right nav to add my css on this layout? http://getbootstrap.com/examples/navbar-fixed-top/
Farhad ali
@alifarhad
Sep 17 2015 04:19
arr.filter() needs a function its body to operate
Bill
@kirah1314
Sep 17 2015 04:19
@djrunas and this isn't really doing anything var args = Array.prototype.slice.call(arguments, 1);
DJ Runas
@djrunas
Sep 17 2015 04:19
Ah, I see.
Farhad ali
@alifarhad
Sep 17 2015 04:19
nope @kirah1314 that's what doing everything D:
Bill
@kirah1314
Sep 17 2015 04:20
ok, what's it doing?
DJ Runas
@djrunas
Sep 17 2015 04:20
I’m not calling it anywhere, correct?
Farhad ali
@alifarhad
Sep 17 2015 04:21
@kirah1314 it takes all the arguments of the destroyer function from index 1; giving you 2, 3 for the first test
Bill
@kirah1314
Sep 17 2015 04:23
but yeah, he's not calling it anywhere
DJ Runas
@djrunas
Sep 17 2015 04:23
Hmmm...
arr.filter(function(element) is new to me.
Farhad ali
@alifarhad
Sep 17 2015 04:24
I got you now @kirah1314 in the context of his above code, it's not doing anything
DJ Runas
@djrunas
Sep 17 2015 04:24
Going to read up on it.
I have to use the args array I created, I just haven’t figured out how to call it so that I can compare it to the values in the array.
Bill
@kirah1314
Sep 17 2015 04:24
i agree it's useful because you can use it for filter()
DJ Runas
@djrunas
Sep 17 2015 04:25
Right.
Maybe I’m just not understanding .filter() fully through.
Anyone know good places to practice them? Or should I just read up on documentation?
Farhad ali
@alifarhad
Sep 17 2015 04:29
DJ Runas
@djrunas
Sep 17 2015 04:29
Thanks @alifarhad :)
CamperBot
@camperbot
Sep 17 2015 04:29
djrunas sends brownie points to @alifarhad :sparkles: :thumbsup: :sparkles:
:star: 196 | @alifarhad | http://www.freecodecamp.com/alifarhad
DJ Runas
@djrunas
Sep 17 2015 04:29
Also, thanks @kirah1314 for providing some guidance as well!
CamperBot
@camperbot
Sep 17 2015 04:29
djrunas sends brownie points to @kirah1314 :sparkles: :thumbsup: :sparkles:
:star: 241 | @kirah1314 | http://www.freecodecamp.com/kirah1314
Bill
@kirah1314
Sep 17 2015 04:30
@djrunas glad to help! FCC been updating the bonfires pretty frequently. I just checked and my old solution doesn't even pass all the tests now lol!
CamperBot
@camperbot
Sep 17 2015 04:30
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
DJ Runas
@djrunas
Sep 17 2015 04:30
Oh, really? LOL
Yeah, I heard the same thing about the palindrome bonfire!
Lots of veterans didn’t realize they added newer tests, so what worked for them may not work for some of the newer people coming in :P
Bill
@kirah1314
Sep 17 2015 04:31
yup, so I'm checking it out now. Yeah the tests are more strict now
but definitely read up on filter(), you'll be using that a lot later
DJ Runas
@djrunas
Sep 17 2015 04:32
Yeah, the link that @alifarhad provided is making this a lot more easier to understand now.
Function myfunc (value, index, array) {
//function body here
}
This is soooooo helpful
Man, where was this link before? LOL
DJ
@qualitymanifest
Sep 17 2015 04:44
yeah i've definitely noticed updates of bonfires and changing their location in the map. some of my old solutions wouldn't work now. it's great to see this keep evolving though. best free code learning site i've found. better than a lot of the paid ones too if you ask me.
DJ Runas
@djrunas
Sep 17 2015 04:44
That’s really good to hear.
To know that they’re actually trying to make the site grow and grow, and the fact that it really shows, is something to really respect.
Jacob Schulz
@jacobaschulz
Sep 17 2015 04:47
Hello all, I'm attempting to generate a random whole number within a certain range. I'm thinking that I got it right but I feel stuck.
DJ Runas
@djrunas
Sep 17 2015 04:47
Post your code and let us know the range you’re trying to produce!
Jacob Schulz
@jacobaschulz
Sep 17 2015 04:47

var min = 0;
var max = 9;
function myFunction() {
// Make myFunction return a random number between zero and nine instead of a decimal
// Only change code below this line.

Math.floor(Math.random() * (max - min + 1)) + min;

return Math.random();
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();

DJ Runas
@djrunas
Sep 17 2015 04:47
help format
CamperBot
@camperbot
Sep 17 2015 04:47

: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

DJ Runas
@djrunas
Sep 17 2015 04:48
Go through this first before you post code! :P
Jacob Schulz
@jacobaschulz
Sep 17 2015 04:48
@djrunas Thanks!
CamperBot
@camperbot
Sep 17 2015 04:48
jacobaschulz sends brownie points to @djrunas :sparkles: :thumbsup: :sparkles:
:star: 200 | @djrunas | http://www.freecodecamp.com/djrunas
Jacob Schulz
@jacobaschulz
Sep 17 2015 04:50

'''js
var min = 0;
var max = 9;
function myFunction() {
// Make myFunction return a random number between zero and nine instead of a decimal
// Only change code below this line.

Math.floor(Math.random() * (max - min + 1)) + min;

return Math.random();
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();
'''

CamperBot
@camperbot
Sep 17 2015 04:50
:bulb: to format code use backticks! ``` more info
Jacob Schulz
@jacobaschulz
Sep 17 2015 04:50
Sorry, trying to get this right

'''html
var min = 0;
var max = 9;
function myFunction() {
// Make myFunction return a random number between zero and nine instead of a decimal
// Only change code below this line.

Math.floor(Math.random() * (max - min + 1)) + min;

return Math.random();
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();'''

CamperBot
@camperbot
Sep 17 2015 04:50
:bulb: to format code use backticks! ``` more info
Jacob Schulz
@jacobaschulz
Sep 17 2015 04:50
I may have to come back to this.
DJ Runas
@djrunas
Sep 17 2015 04:51
No problem!
So you want to use this character `
DJ
@qualitymanifest
Sep 17 2015 04:51
@jacobaschulz so, you used single quotes. you have to use backticks, which are usually on the far upper right side of the keyboard, and you have to apply them above and below the code, not on the same line
DJ Runas
@djrunas
Sep 17 2015 04:51
It’s the one right next to your 1 key.
Correct, what @qualitymanifest said :)
DJ
@qualitymanifest
Sep 17 2015 04:51
* upper LEFT side of the keyboard, oops!
Jacob Schulz
@jacobaschulz
Sep 17 2015 04:51
var min = 0;
var max = 9;
function myFunction() {
  // Make myFunction return a random number between zero and nine instead of a decimal
  // Only change code below this line.

  Math.floor(Math.random() * (max - min + 1)) + min;


  return Math.random();
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();
Mateja Trifunovski
@Matko95
Sep 17 2015 04:51
@jacobaschulz you need to return Math.floor(Math.random() * (max - min + 1)) + min;
Bill
@kirah1314
Sep 17 2015 04:51
@jacobaschulz multiply by 10 for full #
DJ Runas
@djrunas
Sep 17 2015 04:51
Beautiful~
Jacob Schulz
@jacobaschulz
Sep 17 2015 04:52
Thanks everyone!
CamperBot
@camperbot
Sep 17 2015 04:52
if you want to thank someone, put an @ before their name!
Bill
@kirah1314
Sep 17 2015 04:52
var min = 0;
var max = 9;
function myFunction() {
  // Make myFunction return a random number between zero and nine instead of a decimal
  // Only change code below this line.

  Math.floor(Math.random() * (max - min + 1)) + min;


  return Math.random();
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();
was too bright!
@jacobaschulz actually multiply it by 9 since you want a range between 0-9
Jacob Schulz
@jacobaschulz
Sep 17 2015 04:56
@djrunas @Matko95 @qualitymanifest @kirah1314 thanks! Although I still can't seem to get this right. The above code is not used to get the end result, correct?
CamperBot
@camperbot
Sep 17 2015 04:56
jacobaschulz sends brownie points to @djrunas and @matko95 and @qualitymanifest and @kirah1314 :sparkles: :thumbsup: :sparkles:
:warning: jacobaschulz already gave djrunas points
:star: 242 | @kirah1314 | http://www.freecodecamp.com/kirah1314
:star: 216 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
:star: 316 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 17 2015 04:57

@jacobaschulz the result would be


var min = 0;
var max = 9;
function myFunction() {
  // Make myFunction return a random number between zero and nine instead of a decimal
  // Only change code below this line.

  return Math.floor(Math.random() * (max - min + 1)) + min;
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();

```

Jacob Schulz
@jacobaschulz
Sep 17 2015 05:00
@Matko95 Thank you. I had that in the wrong place! That actually makes a lot more sense now.
CamperBot
@camperbot
Sep 17 2015 05:00
jacobaschulz sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:warning: jacobaschulz already gave matko95 points
Jacob Schulz
@jacobaschulz
Sep 17 2015 05:01
I'm actually out for the night/day wherever you all may be. Take care!
Bill
@kirah1314
Sep 17 2015 05:01
@jacobaschulz yup, another solution is to multiply by 9 then use Math.round() and round it to whole #
Jacob Schulz
@jacobaschulz
Sep 17 2015 05:02
@kirah1314 Thanks for the extra info!
CamperBot
@camperbot
Sep 17 2015 05:02
jacobaschulz sends brownie points to @kirah1314 :sparkles: :thumbsup: :sparkles:
:warning: jacobaschulz already gave kirah1314 points
Mateja Trifunovski
@Matko95
Sep 17 2015 05:03
@kirah1314 how can that be a solution
Bill
@kirah1314
Sep 17 2015 05:03
@Matko95 return Math.round(Math.random() * 9);
Mateja Trifunovski
@Matko95
Sep 17 2015 05:03
@kirah1314 but that won't work on FCC
Bill
@kirah1314
Sep 17 2015 05:04
ah ok, was testing it on repl.it
good to know that!
kangyao
@kay78
Sep 17 2015 05:07
what does this means in CSS
 .topnav ul.navbar-nav li a  { }
Mateja Trifunovski
@Matko95
Sep 17 2015 05:09
@kay78 it targets the anchor elements of a list in a navigation bar
kangyao
@kay78
Sep 17 2015 05:11
@Matko95 does it target two elements? can it be rewrite as
.topnav ul   
.navbar-nav li a {  }
Mateja Trifunovski
@Matko95
Sep 17 2015 05:13
ul is an unordered list
and li is a list item
so it's targetting one item, and yes you probably can
kangyao
@kay78
Sep 17 2015 05:17

i'm confuse, i read in w3school,

p.li

means all <p> elements with the class <li>

but in one of the ziplines sample, i saw

.topnav .navbar-brand {
  background: rgba(28, 28, 28, 0.0);
  color: #000;
}

does this means the nav-brand that is a child of topnav ? or it means two seperate classes?

as compare to
.topnav ul.navbar-nav li a:hover .topnav ul.navbar-nav li a:focus{ background: rgba(255,255,255,0.5); color: #fff; }
.topnav ul.navbar-nav li a:hover 
.topnav ul.navbar-nav li a:focus{
   background: rgba(255,255,255,0.5);
   color: #fff;
}
Mateja Trifunovski
@Matko95
Sep 17 2015 05:18
@kay78 li is not a class, it's an element
@kay78 it could look like class="topnav navbar-nav" it doesn't have to be a child
@kay78 but in this case it probably looks like, or something like that
<ul class="top-nav>
<li class="navbar-nav"></li>
</ul>
Mateja Trifunovski
@Matko95
Sep 17 2015 05:24
well gotta sleep now, gnight :)
kangyao
@kay78
Sep 17 2015 05:29
@Matko95 thanks
CamperBot
@camperbot
Sep 17 2015 05:29
kay78 sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 317 | @matko95 | http://www.freecodecamp.com/matko95
Ali-Haider5
@Ali-Haider5
Sep 17 2015 05:32
bonfire palindrome
CamperBot
@camperbot
Sep 17 2015 05:32

: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

Ali-Haider5
@Ali-Haider5
Sep 17 2015 05:32
hint
CamperBot
@camperbot
Sep 17 2015 05:32
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Jason Blacker
@flossless
Sep 17 2015 05:37

I'm not sure what I'm doing wrong with Waypoint: Manipulate Arrays With pop

var myArray = ["John", 23, ["cat", 2]];
// Only change code below this line.
var removed = myArray.pop();
var removed = myArray; // This should be ["cat", 2] and myArray should now be ["John", 23]

Any ideas?

DTing
@dting
Sep 17 2015 05:37
you need to remove this line:
var removed = myArray; // This should be ["cat", 2] and myArray should now be ["John", 23]
Jason Blacker
@flossless
Sep 17 2015 05:39

@dting Thanks... d'oh :)

Btw, why does the empty .pop() remove the whole second array and not just the #2. I thought the .pop function popped off the last string of an array? Am I misunderstanding it?

CamperBot
@camperbot
Sep 17 2015 05:39
flossless sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1195 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Sep 17 2015 05:40
That isnt a second array
its an array inside an array
it is the last element of the outside array
pop removes the last element and returns it
Jason Blacker
@flossless
Sep 17 2015 05:41
@dting Thanks again. This might be a bit advanced for me at this stage, but I'm now curious, what if i just wanted to 'pop' off the last string in that nested array, i.e. pop off just the 2?
CamperBot
@camperbot
Sep 17 2015 05:41
flossless sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:warning: flossless already gave dting points
DTing
@dting
Sep 17 2015 05:41
myArray[myArray.length-1].pop()
Jason Blacker
@flossless
Sep 17 2015 05:42
Cool. That makes sense :)
Anusha Suresh
@anushasuresh89
Sep 17 2015 05:44
blob
SojournerOctocat
@SojournerOctocat
Sep 17 2015 05:46
@anushasuresh89 Hard to your code in that screenshot. Better to paste your code into the chat window if you're wanting help.
help format
CamperBot
@camperbot
Sep 17 2015 05:46

: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

DTing
@dting
Sep 17 2015 05:47
bf seek
CamperBot
@camperbot
Sep 17 2015 05:47

: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

Anusha Suresh
@anushasuresh89
Sep 17 2015 05:47
@SojournerOctocat on it.. :-P was trying to paste it an image editor and this happened accidentally.. will just paste the code.. :)

function destroyer(arr) {
// Remove all the values
arr=arr.filter(function(element){
var decider=true;
for(var i=1;i<destroyer.arguments.length-1;i++)
{
if(element!=destroyer.arguments[i])
decider=decider&&true;
else
decider=decider&&false;
}
return decider;
});
return arr;
}

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

That's the code I wrote for the seek and destroy bonfire..
it returns [1,1]
SojournerOctocat
@SojournerOctocat
Sep 17 2015 05:48
@anaradanarad Easier if you format the code:
help format
help format
CamperBot
@camperbot
Sep 17 2015 05:48

: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

Anusha Suresh
@anushasuresh89
Sep 17 2015 05:49
what does it mean when the checkpoints say.. expected [ 1, 3, 1, 3 ] to deeply equal [ 1, 1 ]?
DTing
@dting
Sep 17 2015 05:50
@anushasuresh89 the only problem you have is that your for loop doesnt loop to the last element
you need to remove that -1
for (var i = 1; i < destroyer.arguments.length; i++) {
Anusha Suresh
@anushasuresh89
Sep 17 2015 05:50
ahhh... thanks :)
CamperBot
@camperbot
Sep 17 2015 05:50
if you want to thank someone, put an @ before their name!
Anusha Suresh
@anushasuresh89
Sep 17 2015 05:51
@dting thanks.. overlooked it :)
CamperBot
@camperbot
Sep 17 2015 05:51
anushasuresh89 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1196 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Sep 17 2015 05:51
you can also tighten up the code by changing the code inside the for statement to just
      if (element === destroyer.arguments[i]) {
        decider = false
      }
Anusha Suresh
@anushasuresh89
Sep 17 2015 05:52
ohhh... will try that.. thanks..
CamperBot
@camperbot
Sep 17 2015 05:52
if you want to thank someone, put an @ before their name!
DTing
@dting
Sep 17 2015 05:53

:point_up: September 16, 2015 10:49 PM as far as that goes, it means that your function returned:

[ 1, 3, 1, 3 ]

And the right answer was:

[ 1, 1 ]
you should also definitely complete the demon hunter
jk
Anusha Suresh
@anushasuresh89
Sep 17 2015 05:56
hahaha..
RobotEyes
@Roboteyes
Sep 17 2015 06:54
I need help on this code >>> Waypoint: Comment out HTML Please
DJ
@qualitymanifest
Sep 17 2015 06:56
@Roboteyes well you have to post your code so we can figure out the problem
RobotEyes
@Roboteyes
Sep 17 2015 06:57
how do i post it? @qualitymanifest
tva10
@tva10
Sep 17 2015 07:00
help formatting
CamperBot
@camperbot
Sep 17 2015 07:00

: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

DJ
@qualitymanifest
Sep 17 2015 07:01
@Roboteyes write three backticks. they look like this ` not like this '. they are located on the far upper left side of your keyboard. THEN, go down a line (shift+enter), paste your code, go down another line and do another three backticks
so yes, like above
Luis Felipe López G.
@luishendrix92
Sep 17 2015 07:03

@Roboteyes

<!-- I'm kind of annoying -->
<!-- But this is blocking my paragraph...
<p>I want to break free</b>
-->

Needs to become

<p>I'm finally free, thanks</p>
CamperBot
@camperbot
Sep 17 2015 07:03
luishendrix92 sends brownie points to @roboteyes :sparkles: :thumbsup: :sparkles:
:star: 6 | @roboteyes | http://www.freecodecamp.com/roboteyes
Tersha
@tersha
Sep 17 2015 07:03
just logged in to work on Bonfire Diff Two Arrays and I'm getting this error in the console: resetting on fatal plugin error
Help?
CamperBot
@camperbot
Sep 17 2015 07:05

Hi, I'm CamperBot! I can help you in this chatroom :smile:

Basic Commands:

  • find TOPIC find all entries about topic. ex: find js
  • wiki TOPIC show contents of topic page
  • thanks @username send brownie points to another user
  • about @username shows info on that user
  • bonfire BONFIRENAME info on a bonfire

:speech_balloon: meet CamperBot in this room!

:pencil: read more about camperbot on the FCC Wiki

tva10
@tva10
Sep 17 2015 07:06
@tersha what the error?
or write code here//
Tersha
@tersha
Sep 17 2015 07:08
@tva10 When I submit my code nothing happens. I can see in the Developer Tools Console there is an error "resetting on fatal plugin error"
Jeremiah
@jerrydtm
Sep 17 2015 07:08
find store
tva10
@tva10
Sep 17 2015 07:09
@tersha what about code?
Tersha
@tersha
Sep 17 2015 07:10
When I dig deeper into the .js file it looks like it's hitting part of the code that's not part of my code but FCC code
I cleared my cache and refreshed everything. Looks like it fixed. :)
Jeremiah
@jerrydtm
Sep 17 2015 07:19
when you have a random number generator and you need it to "store" the number where would i look to see how to do it?
tva10
@tva10
Sep 17 2015 07:20
@jerrydtm you whant to store number in variable? There is one example var myVariableName = Math.random();
Jeremiah
@jerrydtm
Sep 17 2015 07:22
'var slotOne = [Math.floor(Math.random() (3 - 1 + 1)) + 1];
var slotTwo= [Math.floor(Math.random()
(3 - 1 + 1)) + 1];
var slotThree= [Math.floor(Math.random() * (3 - 1 + 1)) + 1];'
im supposed to be building a "slot machine" so i have three places that need random numbers
tva10
@tva10
Sep 17 2015 07:23
don't use [ ] there
Jeremiah
@jerrydtm
Sep 17 2015 07:23
var slotOne = [Math.floor(Math.random() * (3 - 1 + 1)) + 1]; var slotTwo= [Math.floor(Math.random() * (3 - 1 + 1)) + 1]; var slotThree= [Math.floor(Math.random() * (3 - 1 + 1)) + 1];
tva10
@tva10
Sep 17 2015 07:23
@jerrydtm var slotOne = Math.floor(Math.random() (3 - 1 + 1)) + 1;
Jeremiah
@jerrydtm
Sep 17 2015 07:24
thanks @tva10
CamperBot
@camperbot
Sep 17 2015 07:24
jerrydtm sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:star: 228 | @tva10 | http://www.freecodecamp.com/tva10
Jeremiah
@jerrydtm
Sep 17 2015 07:24
now can you explain why that was wrong?
tva10
@tva10
Sep 17 2015 07:28
@jerrydtm may be....
Athul Ganesh
@athul777
Sep 17 2015 07:29
hey guys, can anyone help me understand how to use a json api for the weather zipline/
?
tva10
@tva10
Sep 17 2015 07:31
var slotOne = [Math.floor(Math.random() * (3 - 1 + 1)) + 1]; var slotTwo= [Math.floor(Math.random() * (3 - 1 + 1)) + 1]; @jerrydtm , usually [ ] used to access the array elements. In your case you use [ ] and JS was looking for array .... and not found that.
Jeremiah
@jerrydtm
Sep 17 2015 07:31
ohhhh okay thanks again
CamperBot
@camperbot
Sep 17 2015 07:31
if you want to thank someone, put an @ before their name!
Jeremiah
@jerrydtm
Sep 17 2015 07:32
thanks @tva10
CamperBot
@camperbot
Sep 17 2015 07:32
jerrydtm sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:warning: jerrydtm already gave tva10 points
tva10
@tva10
Sep 17 2015 07:37
@athul777 What confuses you there??
Ali-Haider5
@Ali-Haider5
Sep 17 2015 08:05
Anybody whose just starting bonfires?
Soumya Rauth
@soumyaRauth
Sep 17 2015 08:24
hello everyone.
Mikhail Evdokimov
@evdokimovm
Sep 17 2015 08:25
@soumyaRauth hello
Soumya Rauth
@soumyaRauth
Sep 17 2015 08:25
@evdokimovm i need help with twich tv zipline.
Mikhail Evdokimov
@evdokimovm
Sep 17 2015 08:27
@soumyaRauth I still have not reached there. But I took courses in JS on other sites. We can try to develop together :)
But I do not know where to start
@soumyaRauth But I do not know where to start
And English is not my native language
Soumya Rauth
@soumyaRauth
Sep 17 2015 08:27
@evdokimovm have you looked at the given challenge?
Dealga McArdle
@zeffii
Sep 17 2015 08:28
@soumyaRauth the API is pretty straightforward for twitch
Soumya Rauth
@soumyaRauth
Sep 17 2015 08:30
@evdokimovm Yes thats what i was about to write. I found almost 0% challenge to fetch api information. But I find it really hard to show them on html page. I donno which features should i use to dynamically display the channel's information.
Dealga McArdle
@zeffii
Sep 17 2015 08:30
you can split the challenge into a set of smaller challenges
  • first set up a form input, that takes your keystrokes and prints them to the console
Soumya Rauth
@soumyaRauth
Sep 17 2015 08:30
Should i use append(), or add(), or attr().... I have no exact idea.
@zeffii I could easily display names, logos individually. But, can't show them all.
Dealga McArdle
@zeffii
Sep 17 2015 08:33
to reduce calls to the API i copied the image urls into an object with username: url pairs
Jack Demynn
@infectiouscode
Sep 17 2015 08:34
How do I give something a string value in JS?
Soumya Rauth
@soumyaRauth
Sep 17 2015 08:34
@zeffii I think thats a good idea... U did that for all of the needed information?
@infectiouscode do u want to declare a string?
@infectiouscode or convert a value into string?
Dealga McArdle
@zeffii
Sep 17 2015 08:35
@soumyaRauth just for the sake of completing the challenge, there's stuff you can gather without looking at the code... and image urls is certainly one of them
and it avoids additional API calls.. to be nice :)
Soumya Rauth
@soumyaRauth
Sep 17 2015 08:36
@zeffii So you did not do it dynamically? Thats where i am facing the challenge.
Dealga McArdle
@zeffii
Sep 17 2015 08:37
the image urls is the only hardcoded object.. and the suggested usernames as an array
Soumya Rauth
@soumyaRauth
Sep 17 2015 08:37
@zeffii You displayed the information individually???
@zeffii Did u run a loop?
Dealga McArdle
@zeffii
Sep 17 2015 08:38
many ways to do it and produce what is to the viewer an identical experience.. mine was: http://codepen.io/zeffii/full/zGXwaK/
and yes... use .append if you want... in a loop, but there's a few ways to generate html content that you wish to insert into a div.
it's more fun if you experiment injecting html, and you can do it way before using the twitch api to get the data, you can use mock objects in an array, and loop over them and .append them to a prepared <div>
Mikhail Evdokimov
@evdokimovm
Sep 17 2015 08:44
I do not know which side to this approach. when I did not use the API
APIs
Soumya Rauth
@soumyaRauth
Sep 17 2015 08:45
@zeffii Thats is awesome.
Dealga McArdle
@zeffii
Sep 17 2015 08:48
the challenge is about mixing these technologies (html, css, jquery, twitch json API) , and it means you can figure out the various parts separately before merging them.
Mikhail Evdokimov
@evdokimovm
Sep 17 2015 08:52
I went HTML, CSS, jQuery and JavaScript Basics alt
Raji Reddy
@RajiReddy-A
Sep 17 2015 08:55

Help! wikipedia viewer, code inside getjson is not executed

var theLink="https://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch=Albert%20Einstein&callback=?";

console.log("just before json");

  $.getJSON(theLink,function(reply){
    console.log("getjson entered");
    console.log(reply.warnings);
    $('.results').append(reply);
  },'jsonp');

  console.log("just after json");
CamperBot
@camperbot
Sep 17 2015 08:55
no wiki entry for: wikipedia viewer code inside getjson is not executed var thelinkhttpsenwikipediaorgwapiphpactionquerylistsearchformatjsonsrsearchalbert20einsteincallbackconsolelogjust before json getjsonthelinkfunctionreply consoleloggetjson entered consolelogreplywarnings resultsappendreply jsonp consolelogjust after json
:pencil: click here to create one now!after creating your page type update to reload it here
Soumya Rauth
@soumyaRauth
Sep 17 2015 08:57
@zeffii I can't append it can u please help me out.??? I want to appened the below code within my <ul class="all_channels">
<span ><img class="logo1" src="channel logo link"><a href="#">Channel name</a><li class="channel_link"></li></span>
where I want to change "logo1", "#", and channel name..... Can u help me out @zeffii
Jacob Jamell
@jjamell
Sep 17 2015 09:16
function friendly(str) {
  //there is no 0th month, so null for simplicity
  var month = 
    [null,'January','February','March','April',
           'May','June','July','August',
           'September','October','November','December'];
  var day =
    [null,'1st','2nd','3rd','4th','5th','6th','7th',
          '8th','9th','10th','11th','12th','13th','14th',
          '15th','16th','17th','18th','19th','20th','21st',
          '22nd','23rd','24th','25th','26th','27th','28th',
          '29th','30th', '31st'];

  return str.map(format).map(filter).map(convert);

  //utility map functions
  function filter(date,index,str){
    if(index !== 0)
      return date.filter((item,index,self)=>str[0].indexOf(item) !== index && item !== '2015');
    else
      return date.filter((item)=> item !== '2015');
    }

  function format(str){
    str = str.split('-');  //break it up
    str.push(str.shift()); //move year to the end
    return str;            //return array
  }

  function convert(item){
    return item.map(toDateString).join('');
  }

  function toDateString(item,index,str){
    if(str.length === 1)
      return day[+item];

    switch (index){
      case 0: return month[+item];
      case 1: return ' '+day[+item];
      case 2: return ', '+item;
    }
  }
}

friendly(['2015-12-01', '2016-02-03']);
Dealga McArdle
@zeffii
Sep 17 2015 09:16
@soumyaRauth ok one moment
Dealga McArdle
@zeffii
Sep 17 2015 09:23
@soumyaRauth this is one way to do it : http://codepen.io/zeffii/pen/bVpBjQ
press Edit on that and read the code
and it you can append a string which represents the html (with all the double qoutes escapped using \"
then you can write a function that produces a custom string depending on input..
and then you are pretty much writing your own templating language
Dealga McArdle
@zeffii
Sep 17 2015 09:45
Michał F
@mflisiuk
Sep 17 2015 10:22
function palindrome(str) {
  str = str.toLowerCase().replace(/\s/g, '').replace(/,/g , '').split('.').join('');
  var str1 = str.split('').reverse().join('');
  if(str == str1){
  return true;
    }
  else{
    return str;
  }
}
palindrome("0_0 (: /-\ :) 0-0");
what is wrong with this code?
Dealga McArdle
@zeffii
Sep 17 2015 10:39
@mflisiuk do you know how to use console.log ?
Michał F
@mflisiuk
Sep 17 2015 10:39
yes, F12 in dev tools
Dealga McArdle
@zeffii
Sep 17 2015 10:40
stick a console.log(str, 'vs', str1); right above your if(str === str1)
(use === btw..`)
Michał F
@mflisiuk
Sep 17 2015 10:41
It logged "0_0(:/-:)0-0 vs 0-0):-/:(0_0"
There are ( missing in str1
Dealga McArdle
@zeffii
Sep 17 2015 10:41
you'll see at least why str and reverse str1 are not equal in that case..
Michał F
@mflisiuk
Sep 17 2015 10:41
@zeffii: Thanks
CamperBot
@camperbot
Sep 17 2015 10:41
mflisiuk sends brownie points to @zeffii :sparkles: :thumbsup: :sparkles:
:star: 360 | @zeffii | http://www.freecodecamp.com/zeffii
Dealga McArdle
@zeffii
Sep 17 2015 10:41
welll.. it's the \\
so that's not a fantastic string to check for palindromes with
Dealga McArdle
@zeffii
Sep 17 2015 10:47
@mflisiuk as far as i know, palindrome is only about alphabetic characters
so a reasonable scheme is
  • convert to lowercase
  • replace all non letters with ''
  • make a reverse copy of the result
  • compare result with reverse result
Michał F
@mflisiuk
Sep 17 2015 10:47
@zeffii: I modifed my regex and it worked
Dealga McArdle
@zeffii
Sep 17 2015 10:48
if it passes the tests that's fine.
Arisa Moure
@AriMoure
Sep 17 2015 11:04
guys! got stuck at this, can someone help me out?
var min = 0;
var max = 9;
function myFunction() {
  // Make myFunction return a random number between zero and nine instead of a decimal
  // Only change code below this line.
  return Math.random();
  Math.floor(Math.random() * (max - min)) + min;
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();
CamperBot
@camperbot
Sep 17 2015 11:04
:bulb: to format code use backticks! ``` more info
Binny Kim
@removed~BinnyK
Sep 17 2015 11:05
@AriMoure you're returning Math.random() before the function can do the next line of code
Arisa Moure
@AriMoure
Sep 17 2015 11:07
@BinnyK i agree, i changed it to
Math.floor(Math.random() * (max - min + 1)) + min return Math.random();
but still have an error
Binny Kim
@removed~BinnyK
Sep 17 2015 11:08
@AriMoure Which waypoint is this? I think you will need to return Math.floor(Math.random() * (max - min)) + min. Either store that into a variable, then return it
Arisa Moure
@AriMoure
Sep 17 2015 11:09
ok, so basically i refreshed the freecodecamp page, and it worked :D been stuck with it for half an hour
Binny Kim
@removed~BinnyK
Sep 17 2015 11:10
ah annoying
Arisa Moure
@AriMoure
Sep 17 2015 11:10
@BinnyK thank you for your help and time!
CamperBot
@camperbot
Sep 17 2015 11:10
arimoure sends brownie points to @binnyk :sparkles: :thumbsup: :sparkles:
:star: 126 | @binnyk | http://www.freecodecamp.com/binnyk
Binny Kim
@removed~BinnyK
Sep 17 2015 11:10
all the best
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 11:10
Can someone tell me why this doesn't work. It's the Finders Keepers bonfire. Nothing gets returned.
function find(arr, func) {
  var num = 0;


 for (var i=0;i<=arr.length-1;i++){
     func(arr[i]);
     }

 }


find([1, 2, 3, 4], function(num){ return num % 2 === 0; });
I don't understand what the variable num is for.....
or why the bonfire has "return num"
the function that's being passed in has a return...
where does that go?
Do I need to assign the result to a variable?
Binny Kim
@removed~BinnyK
Sep 17 2015 11:12
@TheHighPriestess normally the return statement that the bonfire first gives you is just a filler... It expects you to change it all to return all the right answers
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 11:13
Yeah...this is kind of confusing...I've never passed a function into a function before
Binny Kim
@removed~BinnyK
Sep 17 2015 11:14
@TheHighPriestess So the bonfire is asking... Check each element of the array... For each of them, if they pass the 2nd argument (function) then return that number
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 11:15
Yeah....but
i need to call that function...and I think I'm doing that correctly
Binny Kim
@removed~BinnyK
Sep 17 2015 11:15
So far in your code you've looped through each of the array elements... which is good. But for each element you're calling the function
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 11:15
I'm calling the function with each value
isn't that what i'm supposed to do?
the test is in that other function
I mean...I could easily write it myself...but isn't that what the other function is for?
Binny Kim
@removed~BinnyK
Sep 17 2015 11:16
Yep. But you're missing one small thing. You're calling but you're not telling it what it should do once you've called it... So you need to change it to... IF when I call the function and it is TURE... return that number
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 11:16
ok...and that's because the function will return TRUE
Binny Kim
@removed~BinnyK
Sep 17 2015 11:17
function find(arr, func) {
  var num = 0;


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

// THIS LINE HERE.... You need to check If its true... then what? We need to know if each number passes the test... If it does.. then return the number... if not then ignore!
     func(arr[i]);

     }

 }


find([1, 2, 3, 4], function(num){ return num % 2 === 0; });
You'll need an if statement wrapping that func[i] call
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 11:19
so....I need to add what's in the function?
i don't get it
I'm sorry. I thought this is what the function being passed in was for
so...what you're saying...if i understand correctly...is that I need to write out this test: num % 2 === 0;
..and then call the function when it's true
Binny Kim
@removed~BinnyK
Sep 17 2015 11:20
Yeah you're pretty much 95% of the way there. You're def on the right track.
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 11:21
wow...i am really confused now. What's the point of passing the function in...if I'm going to do the same thing?
Binny Kim
@removed~BinnyK
Sep 17 2015 11:21
Nope you won't need to do that again. You will just have to say...
if (func(arr[i]) === true) {
return arr[i]
})
ahh
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 11:21
oh....i get it
got it
ok..that makes sense now
Binny Kim
@removed~BinnyK
Sep 17 2015 11:22
Yeah so you were calling it... but you weren't saying IF its true... then tell me that number!
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 11:22
This is the very first time I have encountered this and I am a bit confued
@BinnyK Thank you That helps a lot. That was the missing piece
CamperBot
@camperbot
Sep 17 2015 11:22
thehighpriestess sends brownie points to @binnyk :sparkles: :thumbsup: :sparkles:
:star: 127 | @binnyk | http://www.freecodecamp.com/binnyk
Shoumya Kanti Das
@shoumyadas
Sep 17 2015 11:23
bf Search and
CamperBot
@camperbot
Sep 17 2015 11:23

:fire:Bonfire: Search and Replace :link:

function replace(str, before, after) {
 return str;
}

replace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");

Perform a search and replace on the sentence using the arguments provided and return the new sentence.

more info:  bf details | bf links | hint

Shoumya Kanti Das
@shoumyadas
Sep 17 2015 11:23
bf hint
CamperBot
@camperbot
Sep 17 2015 11:23
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Binny Kim
@removed~BinnyK
Sep 17 2015 11:23
@TheHighPriestess no worries... I've been feeling like that a lot lately... I'm only a bit further ahead of the curriculum than you. Its all very challenging
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 11:33
@BinnyK Yes, it is. I'm learning a lot though.
...and having fun.
Costas Chaitas
@CostasChaitas
Sep 17 2015 11:54
guys where can i see the code from the basejump examples?
Miguel Arribas
@Miguel-Arribas
Sep 17 2015 12:13
Hello everyone
I did something REALLY stupid... got one fo the challenges in an infinite loop
I have been trying to kill it fotr hours now
Even restarting the computer, logging out, using other browers, but when I visit the offending bonfire, it has the same javascript and blocks imemdiately
Any hint, anyone?
Dealga McArdle
@zeffii
Sep 17 2015 12:15
clear your browser cache @Miguel-Arribas
Miguel Arribas
@Miguel-Arribas
Sep 17 2015 12:16
I'll try it right now, @zeffii
Rory Smith
@alanbuchanan
Sep 17 2015 12:19
can anyone help me with some angular? I'm stuck
Miguel Arribas
@Miguel-Arribas
Sep 17 2015 12:20
@Zeffii Thanks a lot, so obvious... just like not doing infinite loops :-)
CamperBot
@camperbot
Sep 17 2015 12:20
miguel-arribas sends brownie points to @zeffii :sparkles: :thumbsup: :sparkles:
:star: 362 | @zeffii | http://www.freecodecamp.com/zeffii
Dealga McArdle
@zeffii
Sep 17 2015 12:28
angular, fire away! @alanbuchanan
Rory Smith
@alanbuchanan
Sep 17 2015 12:29
@zeffii hi dealga
i'm using this http://timeago.yarp.com/
and i'm trying to output the time with angular
but i'm doing something wrong
it's inserted correctly and everything
Dealga McArdle
@zeffii
Sep 17 2015 12:30
ok, where's your code?
Rory Smith
@alanbuchanan
Sep 17 2015 12:30
here is the link to it from my view
<abbr class="timeago" title={{newsItem.timePosted | setISODate}}></abbr>
that's in an ng-repeat of all the objects in the camper news json
here's my filter
app.filter("setISODate", function(){
    return function(n){
        var a = new Date(n);
        return a.toISOString();
    }
});
Dealga McArdle
@zeffii
Sep 17 2015 12:32
are you sure you want to use filter there?
Rory Smith
@alanbuchanan
Sep 17 2015 12:32
no - in fact i tried it with a function attached to the scope first, with the same result
Dealga McArdle
@zeffii
Sep 17 2015 12:33
what is the purpose of that snippet of code.. ?
Rory Smith
@alanbuchanan
Sep 17 2015 12:33
it calls it when it's not assigned to the title attribute (if it's just inner html, for example)
Dealga McArdle
@zeffii
Sep 17 2015 12:33
rather. what do you expect it to do?
Rory Smith
@alanbuchanan
Sep 17 2015 12:33
i expect it to take the 13 digit timecode from the json
convert it to the correct ISO format
and output it with timeago format
Dealga McArdle
@zeffii
Sep 17 2015 12:34
then .map ?
filter would return a subset of an iterable object..
whereas map would change the iterable ?
unless app.filter() is something entirely different than Array.filter()
let me read the angular docs
ok i'm wrong.
zeffii @zeffii reads
Rory Smith
@alanbuchanan
Sep 17 2015 12:35
from the docs
{{ "lower cap string" | uppercase }}
{{ {foo: "bar", baz: 23} | json }}
{{ 1304375948024 | date }}
{{ 1304375948024 | date:"MM/dd/yyyy @ h:mma" }}
indeed, they might have been better off not calling it filter
Dealga McArdle
@zeffii
Sep 17 2015 12:39
the code inside your function doesn't seem to be the problem... so zoom out
kind of tricky without seeing all the code
i'm not super familiar with angular.js .. but it's all js... so
Rory Smith
@alanbuchanan
Sep 17 2015 12:42
i'll make a codepen, just a sec
MrZappy
@MrZappy
Sep 17 2015 12:43
sup guys
Dealga McArdle
@zeffii
Sep 17 2015 12:44
yo sure you don't need to put " around the {{newsItem.timePosted | setISODate}}
hi @MrZappy
I took a lot of screenshots from the Angular js course at codeschool, and unless the template is used inside tags > {{a|b}} < for instance like an attribute.. it always had a qoute like ng-source="{{product.image}}"
Rory Smith
@alanbuchanan
Sep 17 2015 12:55
when i figure this out i am going to kick myself
Dealga McArdle
@zeffii
Sep 17 2015 12:57
<abbr class="timeago" title="{{newsItem.timePosted" |="" setisodate}}=""></abbr>
oh wait.. i am right I think..
="{{newsItem.timePosted | setISODate}}"
and not ={{newsItem.timePosted | setISODate}}
if you look at the html that jquery/angular is producing it's amazing that the DOM even renders
blob
Rory Smith
@alanbuchanan
Sep 17 2015 13:00
haha
oh god...
zeffii @zeffii presents @alanbuchanan with trout to slap self with.
alanbuchanan @alanbuchanan promptly slaps self
Rory Smith
@alanbuchanan
Sep 17 2015 13:01
i still can't figure it out though!
Dealga McArdle
@zeffii
Sep 17 2015 13:01
let me know if that was it.
well... either way.. the html it produces is invalid.
Rory Smith
@alanbuchanan
Sep 17 2015 13:02
starting to think i need to give the inner html a date itself
Dealga McArdle
@zeffii
Sep 17 2015 13:04
you want that result to be visible? or just part of the tag / div
Rory Smith
@alanbuchanan
Sep 17 2015 13:05
@zeffii i just want it to say 5 hours ago
Dealga McArdle
@zeffii
Sep 17 2015 13:06
ok, so newsItem.timePosted isn't being passed then, because it seems to be defaulting to the isodate
Raji Reddy
@RajiReddy-A
Sep 17 2015 13:06

Help! wikipedia viewer, code inside getjson is not executed

var theLink="https://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch=Albert%20Einstein&callback=?";

console.log("just before json");

  $.getJSON(theLink,function(reply){
    console.log("getjson entered");
    console.log(reply.warnings);
    $('.results').append(reply);
  },'jsonp');

  console.log("just after json");
Rory Smith
@alanbuchanan
Sep 17 2015 13:07
@zeffii it must be though, the console logs are doing what is expected
Dealga McArdle
@zeffii
Sep 17 2015 13:08
with is the abbr tag for ?
Rory Smith
@alanbuchanan
Sep 17 2015 13:11
it's just what it says to use on http://timeago.yarp.com/
Dealga McArdle
@zeffii
Sep 17 2015 13:11
jQuery.timeago(jQuery("abbr#some_id"));
Malcolm Brooks
@brooksofmaine
Sep 17 2015 13:12
Good morning...Zipline 4 local weather: my code works fine in on a laptop, but not on an iphone. wondering why. here's the link: http://codepen.io/brooksofmaine/full/qObjNo/
It does take several seconds to load the weather info...
Dealga McArdle
@zeffii
Sep 17 2015 13:14
OK @alanbuchanan i am finally with you..
and because i might use the library eventually.. let's soldier on.
Rory Smith
@alanbuchanan
Sep 17 2015 13:14
:)
i feel like we're so close..
it's not doing it with one timestamp
i've put one in on the updated codepen
Dealga McArdle
@zeffii
Sep 17 2015 13:15
tried the <time tag?
no different..
Rory Smith
@alanbuchanan
Sep 17 2015 13:17
yeah
Dealga McArdle
@zeffii
Sep 17 2015 13:19
pen/qOZrjw is that your updated one?
oh ..this is quite telling... Uncaught TypeError: jQuery(...).timeago is not a function
Rory Smith
@alanbuchanan
Sep 17 2015 13:21
vvkgdm
@vvkgdm
Sep 17 2015 13:22

hi i need ansswers for Each of your Bootstrap buttons should be nested within its own div element with the class col-xs-4. <div class=" row ">

<button class="btn btn-block btn-primary">Like</button>

<button class="btn btn-block btn-info">Info</button>
<button class="btn btn-block btn-danger">Delete</button>
</div>

Rory Smith
@alanbuchanan
Sep 17 2015 13:22
@zeffii damn...it's gonna be how i've imported it isn't it
vvkgdm
@vvkgdm
Sep 17 2015 13:23
hey alan help me out <div class=" row ">
<button class="btn btn-block btn-primary">Like</button>
<button class="btn btn-block btn-info">Info</button>
<button class="btn btn-block btn-danger">Delete</button>
</div>
Each of your Bootstrap buttons should be nested within its own div element with the class col-xs-4.
hollisk
@hollisk
Sep 17 2015 13:25
hi vvkgdm...try wrapping each line in a <div> like so <div class="col-xs-4><button class="btn btn-block btn-primary">Like</button></div>
Rory Smith
@alanbuchanan
Sep 17 2015 13:26
although, i don't see console errors
hollisk
@hollisk
Sep 17 2015 13:26
sorry <div class="col-xs-4"><button class="btn btn-block btn-primary">Like</button></div>
Rory Smith
@alanbuchanan
Sep 17 2015 13:30
@zeffii i think the main problem is that i'm trying to fuse html with angular with jquery
@zeffii i found this alternative which should play nicer with angular
Dealga McArdle
@zeffii
Sep 17 2015 13:35
an angular plugin?
Rory Smith
@alanbuchanan
Sep 17 2015 13:35
yeah
Dealga McArdle
@zeffii
Sep 17 2015 13:35
should have some examples that make sense in your ecosystem.. at least
zeffii @zeffii starts fishing for more trout...
Rory Smith
@alanbuchanan
Sep 17 2015 13:41
:)
JeremyWBean
@JeremyWBean
Sep 17 2015 14:07
Okay, guys/gals. I have just spent the last few days rewriting my Calculator Zipline code. If you could, poke around it and see if you can find any bugs. Any help is greatly appreciated. http://codepen.io/JeremyWBean/full/GpZqwb
Rory Smith
@alanbuchanan
Sep 17 2015 14:09
@zeffii still on it, i'll let you know when i've finally got it
Rory Smith
@alanbuchanan
Sep 17 2015 14:14
Screen Shot 2015-09-17 at 15.14.03.png
close...
Bhaskar Tejaswi
@bhaskarcodes
Sep 17 2015 14:19
@JeremyWBean no it seems great to me
:smile:
Coira Ellison
@Coira
Sep 17 2015 14:20
@JeremyWBean works well for me too, except the exp button on my calculator does something different to what yours does
Stefano
@Stedelie
Sep 17 2015 14:21
Hello everyone! I could use some help with the git 'challanges'! Someone can help me?
JeremyWBean
@JeremyWBean
Sep 17 2015 14:24
@bhaskarcodes Thanks!
CamperBot
@camperbot
Sep 17 2015 14:24
jeremywbean sends brownie points to @bhaskarcodes :sparkles: :thumbsup: :sparkles:
:star: 152 | @bhaskarcodes | http://www.freecodecamp.com/bhaskarcodes
JeremyWBean
@JeremyWBean
Sep 17 2015 14:24
@Coira What does yours do?
Coira Ellison
@Coira
Sep 17 2015 14:27
@JeremyWBean adds zeros, e.g. 3 exp 2 = 300
it's the windows calc
i've forgotten the mathematical term for it
Coira Ellison
@Coira
Sep 17 2015 14:34
oh, something else, spelling mistake: innacurate should be inaccurate, and the message doesn't disappear
JeremyWBean
@JeremyWBean
Sep 17 2015 14:35
Are you multiplying by powers of ten? @Coira
@Coira Thanks! I put all of this time into the coding, but don't give attention to the little things like spelling. It will disappear when you press clear.
Coira Ellison
@Coira
Sep 17 2015 14:36
no i mean, if i enter 3 exp 2 in the windows calc i get 300 and if i enter it in your calc i get 9
CamperBot
@camperbot
Sep 17 2015 14:36
jeremywbean sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 216 | @coira | http://www.freecodecamp.com/coira
JeremyWBean
@JeremyWBean
Sep 17 2015 14:37
Thats what I mean 3 * 10 ^2.
Coira Ellison
@Coira
Sep 17 2015 14:38
ah yes, i see
Dealga McArdle
@zeffii
Sep 17 2015 14:39
looks neat @JeremyWBean !
ultra minimal.
JeremyWBean
@JeremyWBean
Sep 17 2015 14:41
@zeffii Thank you.
CamperBot
@camperbot
Sep 17 2015 14:41
jeremywbean sends brownie points to @zeffii :sparkles: :thumbsup: :sparkles:
:star: 364 | @zeffii | http://www.freecodecamp.com/zeffii
Dealga McArdle
@zeffii
Sep 17 2015 14:42
@alanbuchanan i like this timeago api, I may implement it in my campernews too!
Abdelaziz Mokhnache
@Abdelaziz18003
Sep 17 2015 14:50
where to fetch weather data in zipline 4 ?
Mateja Trifunovski
@Matko95
Sep 17 2015 14:52
@Abdelaziz18003 http://openweathermap.org/api this is a cool API
Omar
@Stenzky
Sep 17 2015 14:55
blob
Hey Guys, can anyone help and tell me what's wrong with the below ? I am not able to get an integer number for some reason :
blob
Abdelaziz Mokhnache
@Abdelaziz18003
Sep 17 2015 14:55
thanks @Matko95 you gentle :smile:
CamperBot
@camperbot
Sep 17 2015 14:55
abdelaziz18003 sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 320 | @matko95 | http://www.freecodecamp.com/matko95
Hans van Riet
@hansinla
Sep 17 2015 14:57
@Stenzky You’re returning Math.random(); That’s not an integer but a real between 0 and 1
Mateja Trifunovski
@Matko95
Sep 17 2015 14:57
@Stenzky you need to return the formula you wrote above
so the function could return it
Rory Smith
@alanbuchanan
Sep 17 2015 14:59
@zeffii i've got the angular one working (oh my god!)
alanbuchanan @alanbuchanan wearily slaps wet trout across face, defeated but content
Omar
@Stenzky
Sep 17 2015 15:00
@Matko95 @hansinla It still gives me a decimal :(
Hans van Riet
@hansinla
Sep 17 2015 15:01
@Stenzky show your current code please. if you return Math.floor(anything) you should get an integer.
Mateja Trifunovski
@Matko95
Sep 17 2015 15:02
he probably wrote 2 returns
Omar
@Stenzky
Sep 17 2015 15:03
blob
Hans van Riet
@hansinla
Sep 17 2015 15:03
@Stenzky You should return the function above it.
Dealga McArdle
@zeffii
Sep 17 2015 15:03
@alanbuchanan was it something stupid?
Mateja Trifunovski
@Matko95
Sep 17 2015 15:04
@Stenzky do you see the code you wrote above? Math.floor(Math.random()*(max-min+1))+min return that as a whole
Rory Smith
@alanbuchanan
Sep 17 2015 15:04
@zeffii it was just fiddly. mostly because angular is pretty new to me
i'll post a pen in a bit
Dealga McArdle
@zeffii
Sep 17 2015 15:04
was it a callback in the app..at the end to trigger timeago() ?
Omar
@Stenzky
Sep 17 2015 15:06
thanks a lot @Matko95 I was starting to get frustrated, cheers !
CamperBot
@camperbot
Sep 17 2015 15:06
stenzky sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 321 | @matko95 | http://www.freecodecamp.com/matko95
Omar
@Stenzky
Sep 17 2015 15:06
thanks @hansinla
CamperBot
@camperbot
Sep 17 2015 15:06
stenzky sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 369 | @hansinla | http://www.freecodecamp.com/hansinla
gee-oge
@gee-oge
Sep 17 2015 15:34
Hello World!
CamperBot
@camperbot
Sep 17 2015 15:34

welcome to FreeCodeCamp @gee-oge!

gee-oge
@gee-oge
Sep 17 2015 15:35
Can anyone help with Bonfire: Check for Palindromes please?
CamperBot
@camperbot
Sep 17 2015 15:35
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
gee-oge
@gee-oge
Sep 17 2015 15:35
bonfire Check for Palindromes
CamperBot
@camperbot
Sep 17 2015 15:35

: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

Hans van Riet
@hansinla
Sep 17 2015 15:39
@gee-oge yes, what’s your question?
JeremyWBean
@JeremyWBean
Sep 17 2015 15:41
I think this is the final version of my calc. Check it out and see what you think before I submit it. (It's a secret nightclub calculator.... Press ctrl + AC to find out what I mean :wink: ) http://codepen.io/JeremyWBean/full/GpZqwb
Hans van Riet
@hansinla
Sep 17 2015 15:42
@JeremyWBean lol
RanaAdnan
@RanaAdnan
Sep 17 2015 16:04
how i chang the colour by changing the style of text
gee-oge
@gee-oge
Sep 17 2015 16:07
@hansinla I'm able to return true when the word is a palindrome but I can't figure out why it fails for the opposite case ie. when it should return false

function palindrome(str) {
// Good luck!
str = str.replace(" ", "");
str = str.replace(/[.,-\/#!$%\^&*;:{}=-_`~()]/g, "");
str = str.toLowerCase();

var array = str.split("");
var revArray = array.reverse();
var rev = revArray.join("");

if (str === rev) {
return true;
}
else {
return false;
}

}
palindrome("eye");

venson7
@venson7
Sep 17 2015 16:09
hey guys. my script got unresponsive, and everytime i refresh the page the same happens (on a specific waypoint). any ideas?
Jason Wood
@catapixel
Sep 17 2015 16:10
@gee-oge you should return false whenever you don't have a string that is the same both forward and backward (ex. 'eye' is a palidrome and 'cat' is not so 'eye' should return true and 'cat' should return false).
@venson7 clear the browser cache. The "bad" code has been saved locally and is reloading each time you load the page. You could also just clear the recent history if that is an option in your browser
venson7
@venson7
Sep 17 2015 16:13
cool, thanks!
CamperBot
@camperbot
Sep 17 2015 16:13
if you want to thank someone, put an @ before their name!
gee-oge
@gee-oge
Sep 17 2015 16:14
@catapixel that's what I'm trying to do in the else block of my if-statement
Jason Wood
@catapixel
Sep 17 2015 16:15
@gee-oge There is no problem with that code. I was just trying to answer your question.
gee-oge
@gee-oge
Sep 17 2015 16:19
Thanks @catapixel
CamperBot
@camperbot
Sep 17 2015 16:19
gee-oge sends brownie points to @catapixel :sparkles: :thumbsup: :sparkles:
:star: 373 | @catapixel | http://www.freecodecamp.com/catapixel
gee-oge
@gee-oge
Sep 17 2015 16:20
I still don't understand why my solution doesn't work
Jason Wood
@catapixel
Sep 17 2015 16:22
@gee-oge which test are you failing? Your first pair of replace statements on str look very complicated. My guess is that you've missed something that should be replaced. By the way, as a hint there are much shorter expressions in the regex documentation that will accomplish the replacement for you without you having to manually type in all of the exceptions.
gee-oge
@gee-oge
Sep 17 2015 16:27
@catapixel The failing tests are the ones for when the word isn't a palindrome. I'll look into simplifying the regex - although I would have thought that if the issue lay there then the true case would fail as well, no?
Jason Wood
@catapixel
Sep 17 2015 16:33
@gee-oge I just copied and pasted your code into FCC exactly as you included it above. The three tests that failed were all supposed to return true. The three tests that failed were:
  • "A man, a plan, a canal. Panama"
  • "never odd or even"
  • "My age is 0, 0 si ega ym."
    All three of those are palidromes once you remove all of the non-word characters and run your check. I can see a couple problems with your setting up the reverse. I can help you there if you wish...
gee-oge
@gee-oge
Sep 17 2015 16:39
@catapixel how strange that different tests are failing on your end. Let me have another stab at it as well as implement your regex hint
Scott Voyles
@zeitchef
Sep 17 2015 16:44
Hi everyone! Looking for some help understanding the "Manipulate JS Objects" in the JS track... the instructions say to give myDog the property "bark", but then also requires me to give the statement a value. Intrinsically, I'm thinking he barks or not, True or False or something. When I gave myDog.bark = "bark"; - the program was happy, but this seems a little illogical. Is there a better way to think of this I'm not seeing? Thanks!
Justin Crawford
@JCrawford1122
Sep 17 2015 16:47
@zeitchef I did myDog.bark = "loud";
Jason Wood
@catapixel
Sep 17 2015 16:48
@zeitchef If memory serves on this one it's looking for the "kind of bark" and not whether it "barks or not"
@gee-oge After testing, once you fix this line with the proper regex str = str.replace(/[.,-\/#!$%\^&*;:{}=-_~()]/g, "");` your code will work...
Scott Voyles
@zeitchef
Sep 17 2015 17:01
After posting, I looked again and in their sample code they give ourDog.bark = "arf!"; - thanks guys!
CamperBot
@camperbot
Sep 17 2015 17:01
if you want to thank someone, put an @ before their name!
winstonlan
@winstonlan
Sep 17 2015 17:18
Bonfire: Seek and Destroy
CamperBot
@camperbot
Sep 17 2015 17:18

: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

winstonlan
@winstonlan
Sep 17 2015 17:18
hint
CamperBot
@camperbot
Sep 17 2015 17:18
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
winstonlan
@winstonlan
Sep 17 2015 17:19
Bonfire: Where do I belong
CamperBot
@camperbot
Sep 17 2015 17:19

: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

winstonlan
@winstonlan
Sep 17 2015 17:19
hint
CamperBot
@camperbot
Sep 17 2015 17:19
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Oleg-docent
@Oleg-docent
Sep 17 2015 17:20
bonfire sum all numbers in a range
CamperBot
@camperbot
Sep 17 2015 17:20

:fire:Bonfire: Sum All Numbers in a Range :link:

function sumAll(arr) {
  return(1);
}

sumAll([1, 4]);

We'll pass you an array of two numbers. Return the sum of those two numbers and all numbers between them.

more info:  bf details | bf links | hint

Oleg-docent
@Oleg-docent
Sep 17 2015 17:20
hint
CamperBot
@camperbot
Sep 17 2015 17:20
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Pete McPherson
@StartupDino
Sep 17 2015 17:37
bonfire reverse a string
CamperBot
@camperbot
Sep 17 2015 17:37

:fire:Bonfire: Reverse a String :link:

function reverseString(str) {
  return str;
}

reverseString('hello');

Reverse the provided string.

more info:  bf details | bf links | hint

Pete McPherson
@StartupDino
Sep 17 2015 17:39
bf details
CamperBot
@camperbot
Sep 17 2015 17:39

:fire:Bonfire: Reverse a String :link:

function reverseString(str) {
  return str;
}

reverseString('hello');
Reverse the provided string.
You may need to turn the string into an array before you can reverse it.
Your result must be a string.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
Pete McPherson
@StartupDino
Sep 17 2015 17:40
hint
CamperBot
@camperbot
Sep 17 2015 17:40
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Jen
@calaminejen
Sep 17 2015 17:41
bonfire reverse a string
CamperBot
@camperbot
Sep 17 2015 17:41

:fire:Bonfire: Reverse a String :link:

function reverseString(str) {
  return str;
}

reverseString('hello');

Reverse the provided string.

more info:  bf details | bf links | hint

Jen
@calaminejen
Sep 17 2015 17:41
hint
CamperBot
@camperbot
Sep 17 2015 17:41
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Jen
@calaminejen
Sep 17 2015 17:41
ahh, i mean
bonfire return largest number
CamperBot
@camperbot
Sep 17 2015 17:41

:fire:Bonfire: Return Largest Numbers in Arrays :link:

function largestOfFour(arr) {
  // You can do this!
  return arr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

Return an array consisting of the largest number from each provided sub-array. For simplicity, the provided array will contain exactly 4 sub-arrays.

more info:  bf details | bf links | hint

Jen
@calaminejen
Sep 17 2015 17:41
hint
CamperBot
@camperbot
Sep 17 2015 17:41
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Bhaskar Tejaswi
@bhaskarcodes
Sep 17 2015 17:42
I wanted to know if I am rushing through the lessons.. I joined just yesterday but have completed the first 4 lessons.. I had some previous exposure to html, css,javascript...
Oleg-docent
@Oleg-docent
Sep 17 2015 17:42
thanks @Rafase282
CamperBot
@camperbot
Sep 17 2015 17:42
oleg-docent sends brownie points to @rafase282 :sparkles: :thumbsup: :sparkles:
:star: 467 | @rafase282 | http://www.freecodecamp.com/rafase282
Pete McPherson
@StartupDino
Sep 17 2015 17:50
bonfire factorialize a number
CamperBot
@camperbot
Sep 17 2015 17:50

:fire:Bonfire: Factorialize a Number :link:

function factorialize(num) {
  return num;
}

factorialize(5);

Return the factorial of the provided integer.

more info:  bf details | bf links | hint

Pete McPherson
@StartupDino
Sep 17 2015 17:51
hint
CamperBot
@camperbot
Sep 17 2015 17:51
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Hans van Riet
@hansinla
Sep 17 2015 18:04
@bhaskarcodes You’re good
Rory Smith
@alanbuchanan
Sep 17 2015 18:17
i've pretty much finished my camper news zipline, but i need some help with the infinite scroll using ngInfiniteScroll. can anyone help? here's a link to my codepen
@zeffii codepen with timestamp above :)
crap, wrong link, HERE is a link to my codepen
Dealga McArdle
@zeffii
Sep 17 2015 18:24
nice work @alanbuchanan !
Arisa Moure
@AriMoure
Sep 17 2015 18:24
var min = 0;
var max = 9;
function myFunction() {
  // Make myFunction return a random number between zero and nine instead of a decimal
  // Only change code below this line.
  Math.floor(Math.random() * (max - min + 1)) + min
  return Math.random();
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();
Help me please!
I got stuck at this, couldn't find any solutions yet. Waypoint: Generate Random Whole Numbers within a Range
Rory Smith
@alanbuchanan
Sep 17 2015 18:25
@zeffii thanks :) any idea for the infinite scroll?
CamperBot
@camperbot
Sep 17 2015 18:25
alanbuchanan sends brownie points to @zeffii :sparkles: :thumbsup: :sparkles:
:star: 365 | @zeffii | http://www.freecodecamp.com/zeffii
Dealga McArdle
@zeffii
Sep 17 2015 18:25
nope.. you'll be fine tho :)
Pete McPherson
@StartupDino
Sep 17 2015 18:25
bonfire check for palindrones
CamperBot
@camperbot
Sep 17 2015 18:25
Sorry, can't find a bonfire called check for palindrones. [ Check the map? ]
Pete McPherson
@StartupDino
Sep 17 2015 18:25
bonfire check for palidromes
CamperBot
@camperbot
Sep 17 2015 18:25
Sorry, can't find a bonfire called check for palidromes. [ Check the map? ]
Dealga McArdle
@zeffii
Sep 17 2015 18:26
'palindromes'
Rory Smith
@alanbuchanan
Sep 17 2015 18:27
@zeffii i've been at it for a while now...it's even harder than getting the stupid time ago right...
marzelin
@marzelin
Sep 17 2015 18:29
@AriMoure
var min = 0;
var max = 9;
function myFunction() {
  // Make myFunction return a random number between zero and nine instead of a decimal
  // Only change code below this line.

  return Math.floor(Math.random() * (max - min + 1)) + min;
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();
Arisa Moure
@AriMoure
Sep 17 2015 18:30
LOL, I feel so dumb >.<
@marzelin thank you a MILLION times!!!!
CamperBot
@camperbot
Sep 17 2015 18:30
arimoure sends brownie points to @marzelin :sparkles: :thumbsup: :sparkles:
:star: 218 | @marzelin | http://www.freecodecamp.com/marzelin
harsh593
@harsh593
Sep 17 2015 18:36

guys can anyyone pls help me out with this one !

can't figure out the problem

Drew
@clarkdh
Sep 17 2015 18:53

this code seems to just return arr not sure why: function destroyer(arr) {
// Remove all the values
var i = 1;
var arr2 = [];
var bool = false;

function dest(value){
while(i < arguments.length){
if(value === arguments[i]){
bool = true;
}
i++;
}

if(bool != true){
  return value;
}

}
return arr2 = arr.filter(dest);
}

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

sorry
function destroyer(arr) {
  // Remove all the values
  var i = 1;
  var arr2 = [];
  var bool = false;

  function dest(value){
    while(i < arguments.length){
      if(value === arguments[i]){
        bool = true;
      }
      i++;
    }

    if(bool != true){
      return value;
    }
  }
  return arr2 = arr.filter(dest);
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3, "");
tva10
@tva10
Sep 17 2015 18:56
@clarkdh hey, what about .filter() function. It makes this code more easier
Drew
@clarkdh
Sep 17 2015 18:57
@tva10 I use .filter() see return line
tva10
@tva10
Sep 17 2015 18:57
oops not seen that
@clarkdh I think you can make it more simple
if you will return value after comparison
Drew
@clarkdh
Sep 17 2015 19:00
@tva10 not sure what you mean
tva10
@tva10
Sep 17 2015 19:00
@clarkdh I mean, you don't need more comparsion, after that you find a value === arguments[i]
@clarkdh ahh I know, why it is not working
Drew
@clarkdh
Sep 17 2015 19:02
but I have to cycle through each of the arguements before I return,
Arisa Moure
@AriMoure
Sep 17 2015 19:02

@harsh593

```

tva10
@tva10
Sep 17 2015 19:02
@clarkdh this argument variable is in other scope, and works for destroyer function
Drew
@clarkdh
Sep 17 2015 19:02
ohhh
Arisa Moure
@AriMoure
Sep 17 2015 19:03
@harsh593
    slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
    slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
    slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;

    $(".logger").html("");
    $(".logger").html("Not A Win")

    // Only change code below this line.
    $($(".slot")[1]).html(slotOne);
    $($(".slot")[2]).html(slotTwo);
    $($(".slot")[0]).html(slotThree);
    // Only change code above this line.

    if(slotOne !== slotTwo || slotTwo !== slotThree){
      return null;
    }
there
tva10
@tva10
Sep 17 2015 19:03
@clarkdh if you want to get arguments from other scope you need to save it to another wariable..
Drew
@clarkdh
Sep 17 2015 19:03
thanks!
CamperBot
@camperbot
Sep 17 2015 19:03
if you want to thank someone, put an @ before their name!
tva10
@tva10
Sep 17 2015 19:03
and make it simplier
Drew
@clarkdh
Sep 17 2015 19:03
@tva10 thanks!
CamperBot
@camperbot
Sep 17 2015 19:03
clarkdh sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:star: 230 | @tva10 | http://www.freecodecamp.com/tva10
Barrett
@Tao0fpooh
Sep 17 2015 19:04
can someone explain this for loop logic to me with regards to the palindrome bonfire?
tva10
@tva10
Sep 17 2015 19:04
@clarkdh next, look how .filter() works
marzelin
@marzelin
Sep 17 2015 19:05
@Tao0fpooh for loop repeats code a certain number of times
tva10
@tva10
Sep 17 2015 19:05
@clarkdh it return new array from values on which function get true
Barrett
@Tao0fpooh
Sep 17 2015 19:05
for(var i = 0, len = str.length - 1; i < len/2; i++) {
if (str[i] !== str[len - i])
I compared racecar with rattear (mad up word both starting and ending in r) and returned str[i] by it self or returned str[len-i] by itself and they both === r in both cases.....however when applying whole function and asking for boolean return of true or false then it confirms racecar is palindrome(true) and rattear is not (false)
marzelin
@marzelin
Sep 17 2015 19:08
@Tao0fpooh for index = 0 to the index of the middle element do: check if the first element is different than last element, then check if second element is different than the second to last element, then...
Pete McPherson
@StartupDino
Sep 17 2015 19:13
bonfire find the longest string
CamperBot
@camperbot
Sep 17 2015 19:13
Sorry, can't find a bonfire called find the longest string. [ Check the map? ]
Pete McPherson
@StartupDino
Sep 17 2015 19:13
Bonfire: Find the Longest Word in a String
CamperBot
@camperbot
Sep 17 2015 19:13

:fire:Bonfire: Find the Longest Word in a String :link:

function findLongestWord(str) {
  return str.length;
}

findLongestWord('The quick brown fox jumped over the lazy dog');

Return the length of the longest word in the provided sentence.

more info:  bf details | bf links | hint

Pete McPherson
@StartupDino
Sep 17 2015 19:13
hint
CamperBot
@camperbot
Sep 17 2015 19:13
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
tva10
@tva10
Sep 17 2015 19:14
This message was deleted
CamperBot
@camperbot
Sep 17 2015 19:14
you need to ask about @someone!
Barrett
@Tao0fpooh
Sep 17 2015 19:14
@marzelin ahh i get how it works now
@marzelin what does the i<len/2 do?
marzelin
@marzelin
Sep 17 2015 19:16
@Tao0fpooh len stores the length of the array, so len/2 is half of that number
you don't have to loop through every element of the array, it's enough to compare first half of the array with the second half of the array
grimc
@grimc
Sep 17 2015 19:18
Problem completing Bonfire: Reverse a string. I can reverse the strings, but don't understand how to meet the three success conditions. Do I need to create a function for each of the strings?
Barrett
@Tao0fpooh
Sep 17 2015 19:19
thanks much @marzelin
CamperBot
@camperbot
Sep 17 2015 19:19
tao0fpooh sends brownie points to @marzelin :sparkles: :thumbsup: :sparkles:
:star: 219 | @marzelin | http://www.freecodecamp.com/marzelin
Rex Schrader
@SaintPeter
Sep 17 2015 19:19
@grimc You need to use the variable/parameter that is passed in
@grimc You don't "hard code" the strings.
@grimc Can you post your code?
wiki format
CamperBot
@camperbot
Sep 17 2015 19:19

: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 17 2015 19:19
@grimc Here is how ^
grimc
@grimc
Sep 17 2015 19:22

@SaintPeter ```js
function reverseString(str, sep) {
var strArray = str.split(sep);
strArray = strArray.reverse();
str = strArray.join(sep);
return str;
}

reverseString("hello", "");
//reverseString("Howdy", "");
//reverseString("Greetings from Earth", "");
```

@SaintPeter
Rex Schrader
@SaintPeter
Sep 17 2015 19:22
@grimc Do a shift-enter after the first ```
Tim P
@xTimpi
Sep 17 2015 19:22
Hey guys, I’m still struggeling with setting up the Cloud9 base project for the basejumps, I am absolutely done with it at this point lol - I want to run a virtual machine on my laptop now, can anyone recommend a good linux distribution for that? or even windows?
Rex Schrader
@SaintPeter
Sep 17 2015 19:23
@grimc I'm not understanding the argument sep - that's not in the problem description
grimc
@grimc
Sep 17 2015 19:24
@SaintPeter I thought I needed to pass the second argument in the original function
@SaintPeter This is my first time in here - sorry for my ignorance about formatting etc
Rex Schrader
@SaintPeter
Sep 17 2015 19:25
@grimc Nope. Just use '' to split the string by character and to rejoin it.
@xTimpi You can install on windows, no problem - that's my personal dev environement
grimc
@grimc
Sep 17 2015 19:26
@SaintPeter Did it. Thanks!
CamperBot
@camperbot
Sep 17 2015 19:26
grimc sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 643 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 17 2015 19:26
@xTimpi I think they're working on a Wiki article, but I easily found out how to do it by googling
Tim P
@xTimpi
Sep 17 2015 19:26
@SaintPeter I figured linux would be easier to install and set up
Rex Schrader
@SaintPeter
Sep 17 2015 19:27
@xTimpi Nope. All of the same tools work cross platform. I'm running Win10 and I was able to get up and running in about an hour, with some minor googling.
Tim P
@xTimpi
Sep 17 2015 19:27
@SaintPeter I spent a good 10 hours on setting it up on cloud9 and I always ended up with one of five different errors
Rex Schrader
@SaintPeter
Sep 17 2015 19:27
@xTimpi Also, the Basejumps Help Channel can sometimes be helpful.
@xTimpi I also gave up on c9. I did get it working, but it was slow and ugly.
@xTimpi and I kept running out of space.
Tim P
@xTimpi
Sep 17 2015 19:32
@SaintPeter okay thanks, I’ll look into setting it up on a windows virtual machine
CamperBot
@camperbot
Sep 17 2015 19:32
xtimpi sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 644 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 17 2015 19:32
@xTimpi No need for a VM. Just set it up. What platform are you on?
Tim P
@xTimpi
Sep 17 2015 19:33
I’m on mac and I really don’t want to mess with the system and I want to set up the whole node/npm stuff up in a sandbox
Rex Schrader
@SaintPeter
Sep 17 2015 19:39
@xTimpi Oh - I'd actually suggest just installing in Mac
@xTimpi You're really unlikely to break anything.
@xTimpi And Mac is natively unix. It's actualyl much easier/better than Windows
@xTimpi It's kinda the dev enviroment of choice for web devs these days.
Tim P
@xTimpi
Sep 17 2015 19:39
@SaintPeter yeah thats why I was aiming for a linux sandbox since I’m familliar with unix
@SaintPeter looking around my office at work its pretty much the environment of choice for every developer :D except C# of course
Rex Schrader
@SaintPeter
Sep 17 2015 19:41
@xTimpi In that case, Ubuntu is probably fine. Most user friendly. I don't know much about virtualization on the Mac .. . I jsut think it's overkill. I run my dev enviornment on Windows and never have any issues. I can't imagine why you wouldn't want to on Mac.
CaPuK
@CaPuK
Sep 17 2015 19:41

Hi guys I need help with exercise #171
Bonfire: Reverse a String
Difficulty: 
Reverse the provided string.

You may need to turn the string into an array before you can reverse it.

Your result must be a string.

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

Here is the original code that was provided:
function reverseString(str) {
return str;
}

reverseString("hello", "");

Tim P
@xTimpi
Sep 17 2015 19:41
@SaintPeter I guess you are right, I’ll set it up on mac
CaPuK
@CaPuK
Sep 17 2015 19:42

function reverseString(str) {

reverseString = str.split(" ");

reverseString.reverse();

var str = reverseString.join(" ");

return str;

}

reverseString("hello", "");
This is what I got

Rex Schrader
@SaintPeter
Sep 17 2015 19:43
@CaPuK In order to split a string into characters you need to pass an empty string '' to split (and to re-merge it, same thing for join)
@CaPuK Right now you're splitting on " " (IE: a space), but there are no spaces in the strings .. . or rather they're not where you want to split
Tim P
@xTimpi
Sep 17 2015 19:44
@SaintPeter do I have to have the mongodb running in order to deploy the website to heroku? or does heroku clone everything from the repo and runs it on its own server?
Barrett
@Tao0fpooh
Sep 17 2015 19:45
Bonfire: Title Case a Sentence
CamperBot
@camperbot
Sep 17 2015 19:45

:fire:Bonfire: Title Case a Sentence :link:

function titleCase(str) {
  return str;
}

titleCase("I'm a little tea pot");

Return the provided string with the first letter of each word capitalized.

more info:  bf details | bf links | hint

Barrett
@Tao0fpooh
Sep 17 2015 19:45
hint
CamperBot
@camperbot
Sep 17 2015 19:45
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Rex Schrader
@SaintPeter
Sep 17 2015 19:45
@xTimpi You do need a local instance of mongdb running to do local development. And you absolutely will need to develop locally before you deploy to Heroku - Heroku provides almost no logging or interface to your code.
@xTimpi Heroku is a black box where your code goes to run, eventally
Tim P
@xTimpi
Sep 17 2015 19:46
@SaintPeter okay thank you
CamperBot
@camperbot
Sep 17 2015 19:46
xtimpi sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: xtimpi already gave saintpeter points
CaPuK
@CaPuK
Sep 17 2015 19:49
Thank you @SaintPeter it looks like it worked on the compiler, I can see "olleh" on the screen. But my challenge checkmarks are not turning green. Could it be because it is not turned back to string? Which I though was supposed to be done by var str = reverseString.join("");
CamperBot
@camperbot
Sep 17 2015 19:49
capuk sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 647 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 17 2015 19:50
@CaPuK Well, you need to return the reversed value.
@CaPuK I don't think you need a var in front of str
CaPuK
@CaPuK
Sep 17 2015 19:54
@SaintPeter It is returning it as "olleh" instead of "hello" . But my challenge doesn't want to finish, you know how you have to go through checks and make them turn green. Basically I think the problem is "Your result must be a string." Because the checkmark requires " assert(typeof(reverseString("hello")) === "string", 'reverseString() should return a string.'); "
Rex Schrader
@SaintPeter
Sep 17 2015 19:55
@CaPuK Can you paste your code again?
CaPuK
@CaPuK
Sep 17 2015 19:55

@SaintPeter function reverseString(str) {

reverseString = str.split("");

reverseString.reverse();

str = reverseString.join("");

return str;

}

reverseString("hello", "");

Rex Schrader
@SaintPeter
Sep 17 2015 19:56
@CaPuK ok, change your variable name reverseString to something else and, on the first line, declare it with a var. The problem, I think, is that you're confusing it by using the same name for your variable as you're using for a function. Call it revStr or something.
Tim P
@xTimpi
Sep 17 2015 19:56
@SaintPeter I could use your help again :) so I set everything up but after installing the npm packages the terminal still says „command not found“ is that because I didn’t install them globally using the -g flag?
Rex Schrader
@SaintPeter
Sep 17 2015 19:57
@xTimpi Which command? npm?
Tim P
@xTimpi
Sep 17 2015 19:57
@SaintPeter npm install yo (or grunt / bower) whatever
Rex Schrader
@SaintPeter
Sep 17 2015 19:58
@xTimpi My guess: when node installed it didn't put npm in the path. You're gonna have to google that one.
@xTimpi try whereis npm or whence npm
Tim P
@xTimpi
Sep 17 2015 19:58
@SaintPeter I installed every package and wanted to run „yo angular-fullstack“ and it says „cant find command yo"
CaPuK
@CaPuK
Sep 17 2015 19:58
@SaintPeter You're awesome. It worked. Thank you!
CamperBot
@camperbot
Sep 17 2015 19:58
capuk sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: capuk already gave saintpeter points
Tim P
@xTimpi
Sep 17 2015 19:58
@SaintPeter no the path variable looks alright
Rex Schrader
@SaintPeter
Sep 17 2015 19:59
@xTimpi So, yeah, if you don't install with -g, then yo will probably not be in the path . . but that's a guess. (not a mac expert)
Tim P
@xTimpi
Sep 17 2015 19:59
ohh I see what you mean
DTing
@dting
Sep 17 2015 19:59
function reverseString(str) {
  var reverseString = str.split("");
  reverseString.reverse();
  str = reverseString.join("");
  return str;
}
reverseString("hello");
This actually works if you dont use the global reverseString inside the function. It is a bit weird and would break if it were recursive.
Rex Schrader
@SaintPeter
Sep 17 2015 20:00
@dting @CaPuK My advice, for the sanity of future code readers is to have a different variable name ;)
Tim P
@xTimpi
Sep 17 2015 20:00
@SaintPeter I’ll just install everything globally
DTing
@dting
Sep 17 2015 20:00
which npm
Rex Schrader
@SaintPeter
Sep 17 2015 20:00
@xTimpi Ack
@xTimpi I'm not sure I advise that
Tim P
@xTimpi
Sep 17 2015 20:00
@SaintPeter haha thats why I didn’t do that in the first place
DTing
@dting
Sep 17 2015 20:01
are you using homebrew?
Rex Schrader
@SaintPeter
Sep 17 2015 20:01
@xTimpi There are two types of packages: Those that you need to install other packages or do global things - like NPM, Yeoman, and maybe a select few others, like the angular fullstack generator - and then there are those that are specific to your apps.
@xTimpi install the former globally and the latter locally
DTing
@dting
Sep 17 2015 20:02
homebrew is an awesome package manager for osx
CaPuK
@CaPuK
Sep 17 2015 20:02
@dting Yep, that's exactly how I did it.
Tim P
@xTimpi
Sep 17 2015 20:02
@dting whats the difference between using homebrew or the standard terminal?
oh its a package manager not a console, I see
Risle
@Risle
Sep 17 2015 20:30

Is there a better way to add a list element from a button click with JQuery? Here I have an anonymous callback function that appends the list element. It seems lame.

$('#btn4').click(function() {
    $('#' + parentID).append('<li>' + textStr + '</li>');
});

Here is the link to the whole codepen:
http://codepen.io/Risle/pen/eppLbw/

Rory Smith
@alanbuchanan
Sep 17 2015 20:31
Screen Shot 2015-09-17 at 21.25.27.png
anyone know why i'm getting this error when updating yeoman generators?
Rex Schrader
@SaintPeter
Sep 17 2015 20:39
@Risle That seems like a reasonable solution. If you know where it will be appended, no need to construct the selector in that way, but that's a method I use all the time.
Risle
@Risle
Sep 17 2015 20:42
@SaintPeter What part is the selector? The 'parentID' variable?
I see in JQuery automatically closes the HTML tag, so the li can just be: ('<li> + textStr)
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 20:51
Can someone tell me why 1,2,3,7,4 here....only returns 4 instead of 7,4?
function drop(arr, func) {
    if (func(arr[0]) === true){
        return arr;
    }

    for (var i=0;i<arr.length;i++){
        shifted = arr.shift();
        if (func(shifted) === true){
        return arr;
        }

    else {
       shifted = arr.shift();
    }


}

return arr;
}

//drop([1, 2, 3], function(n) {return n > 0; });
//drop([1, 2, 3, 4], function(n) {return n > 5; });
drop([1, 2, 3, 7, 4], function(n) {return n > 5; });
Tim P
@xTimpi
Sep 17 2015 20:53
@dting can you help me out with homebrew? I installed it but I can’t get the packages to work, something is wrong with my bashrc file
Rex Schrader
@SaintPeter
Sep 17 2015 20:54
@TheHighPriestess You
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 20:54
@SaintPeter Me?
Rex Schrader
@SaintPeter
Sep 17 2015 20:55
@TheHighPriestess You're returning arr - return immediatly exits the function. You'r going to need to store up your values somewhere befoer you return them all
@TheHighPriestess Sorry, power wen ot and I'm on my lapto keyboard whcih I never use
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 20:55
oh haha
@SaintPeter right....i have these returns scattered around
@SaintPeter ok...thank you. I will correct that...and hopefully get it working.
CamperBot
@camperbot
Sep 17 2015 20:57
thehighpriestess sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 649 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 17 2015 21:00
@TheHighPriestess Humm . . . Your answer may be more correct than I thought. The problem is that you're doing a second shift before you test it
@TheHighPriestess
for (var i=0;i<arr.length;i++){
        shifted = arr.shift(); // Mght need to move this after the test
        if (func(shifted) === true){
        return arr;
        }

    else {
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 21:02
@SaintPeter ok....let me try that...thanks
CamperBot
@camperbot
Sep 17 2015 21:02
thehighpriestess sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: thehighpriestess already gave saintpeter points
Afroz (zorfa)
@zorfa
Sep 17 2015 21:03
This message was deleted
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 21:03
@SaintPeter that returns 2,3,7,4
@SaintPeter the thing is....IF it's true....shouldn't it return the arr without doing anything else?
Rex Schrader
@SaintPeter
Sep 17 2015 21:05
@TheHighPriestess Humm. You want to keep shifting until it's false, right? You need to make sure you never shift twice in a row.
Elizabeth Hatleli
@TheHighPriestess
Sep 17 2015 21:05
@SaintPeter oh wait...i think it's working
i got rid of the extra shift
@SaintPeter now it doesn't work for 1, 2,3,4 LOL
Steve Carroll
@SteveCarroll
Sep 17 2015 21:20
Is there a bug in :Bonfire: Check for Palindromes
it states: "0_0 (: /-\ :) 0-0" should return true.
why would that return true?
Hans van Riet
@hansinla
Sep 17 2015 21:21
@SteveCarroll Because you’re supposed to remove non standard characters & punctuation before the comparison.
Steve Carroll
@SteveCarroll
Sep 17 2015 21:22
SO the underscore and the dash are to be removed?
@hansinla It only says to ignore "punctuation, case, and spacing"
Hans van Riet
@hansinla
Sep 17 2015 21:25
@SteveCarroll Yes, remove everything that’s not a-z
Jack Demynn
@infectiouscode
Sep 17 2015 21:33
hey guys, apparently im just meant to follow the comment instructions, I did so, but apparently its wrong?
// On line 2, declare a variable myName and give it your name.
var myName =("Jack Demynn");
// On line 4, use console.log to print out the myName variable.
console.log= ("Jack Demynn");
// On line 7, change the value of myName to be just the first 2 
// letters of your name.
myName.substring(0,1);
// On line 9, use console.log to print out the myName variable.
console.log = ("Jack Demynn");
Coira Ellison
@Coira
Sep 17 2015 21:34
@infectiouscode just a couple of syntax mistakes
var myName = "Jack Demynn"
Jack Demynn
@infectiouscode
Sep 17 2015 21:35
how come no brackets and semi-colon?
Coira Ellison
@Coira
Sep 17 2015 21:35
and console.log("Jack Demynn");
Jack Demynn
@infectiouscode
Sep 17 2015 21:35
and why no equals >.< I dont understand js as much as html and css
Coira Ellison
@Coira
Sep 17 2015 21:35
oops, you need the semi-colon, mistake on my part
Tim P
@xTimpi
Sep 17 2015 21:36
@infectiouscode console is just an object, you call the .log() method on it
Coira Ellison
@Coira
Sep 17 2015 21:36
no brackets because you're giving myName a value, generally you'd need brackets when calling a function (e.g. console.log is a function)
Hans van Riet
@hansinla
Sep 17 2015 21:36
@infectiouscode You should end with a semi-colon.
var myName = "Jack Demynn”;
Jack Demynn
@infectiouscode
Sep 17 2015 21:37
ok thankyou, its still giving me an error the box says "Console.log is not a function"
Coira Ellison
@Coira
Sep 17 2015 21:38
paste code
Jack Demynn
@infectiouscode
Sep 17 2015 21:38
// On line 2, declare a variable myName and give it your name.
var myName = "Jack Demynn";
// On line 4, use console.log to print out the myName variable.
console.log("Jack Demynn");
// On line 7, change the value of myName to be just the first 2 
// letters of your name.
myName.substring(0,1);
// On line 9, use console.log to print out the myName variable.
console.log("Jack Demynn");