These are chat archives for FreeCodeCamp/Help

20th
Sep 2015
Yago Ferrer
@yagoferrer
Sep 20 2015 00:01
@jhonnathan78
check out the example of array.map
you are going to need this function
Jhonnathan
@jhonnathan78
Sep 20 2015 00:02
oh i was so close
i had created a new variable
but apparently they want you to use the same array
Yago Ferrer
@yagoferrer
Sep 20 2015 00:02
you don't need to create a new variable
try to understand what the function does
when you run the tests, check the failed result: 'expected'
what do you get?
Jhonnathan
@jhonnathan78
Sep 20 2015 00:04
yeah It works now
array = array.map(function(val){
return val+3;
});
i was doing the following
Yago Ferrer
@yagoferrer
Sep 20 2015 00:04
nice :P
Jhonnathan
@jhonnathan78
Sep 20 2015 00:04
var myArray = array.map(function(val){
return val+3;
});
Yago Ferrer
@yagoferrer
Sep 20 2015 00:04
you can only use 'var' one time.
when you define the variable
Jhonnathan
@jhonnathan78
Sep 20 2015 00:05
yeah but in this case I was trying to put it in a new variable call myArray
Yago Ferrer
@yagoferrer
Sep 20 2015 00:07
I see, you can still do that, but after the array.map function
you need to do this: array = myArray;
because line 13 returns the value of 'array' not 'myArray'
does that make sense?
Jhonnathan
@jhonnathan78
Sep 20 2015 00:08
oh yes go tit
it
always forget to look at the last part on this examples
Yago Ferrer
@yagoferrer
Sep 20 2015 00:09

/code //Use map to add three to each value in the array
var array = [1,2,3,4,5];
// Only change code below this line.

var myArray = array.map(function(val){
  return val+3;
});

array = myArray;

// Only change code above this line.
(function() {return array;})();

Jhonnathan
@jhonnathan78
Sep 20 2015 00:09
most of the time they are just validating our answers
fxmt2009
@fxmt2009
Sep 20 2015 00:09
waypoint-bring-your-javascript-slot-machine-to-life not working
Yago Ferrer
@yagoferrer
Sep 20 2015 00:10
right, the last line is a self-invoked function
and it returns a variable value
fxmt2009
@fxmt2009
Sep 20 2015 00:10
Here is my code $($('.slot')[0]).html('slotOne');
$($('.slot')[1]).html('slotTwo');
$($('.slot')[2]).html('slotThree');

waypoint-bring-your-javascript-slot-machine-to-life not working.
Where did I go wrong?

 $($('.slot')[0]).html('slotOne');
$($('.slot')[1]).html('slotTwo');

$($('.slot')2).html('slotThree');

fxmt2009
@fxmt2009
Sep 20 2015 00:16

waypoint-bring-your-javascript-slot-machine-to-life not working.
Where did I go wrong?

 $($('.slot')[0]).html('slotOne');
$($('.slot')[1]).html('slotTwo');

$($('.slot')2).html('slotThree');

Sorry, every time I copy and paste the code, it messes up the third line.
Yago Ferrer
@yagoferrer
Sep 20 2015 00:16
you are adding a string 'slotOne', not the result of the variable slotOone
fxmt2009
@fxmt2009
Sep 20 2015 00:18
God! Thanks. Working now. Thank you Yagoferrer. Very helpful.
CamperBot
@camperbot
Sep 20 2015 00:18
if you want to thank someone, put an @ before their name!
fxmt2009
@fxmt2009
Sep 20 2015 00:18
@yagoferrer Thank you
CamperBot
@camperbot
Sep 20 2015 00:18
fxmt2009 sends brownie points to @yagoferrer :sparkles: :thumbsup: :sparkles:
:star: 22 | @yagoferrer | http://www.freecodecamp.com/yagoferrer
Yago Ferrer
@yagoferrer
Sep 20 2015 00:20
nice!
Thomas Vaeth
@thomasvaeth
Sep 20 2015 00:26
@MattYamamoto @richchurcher I walked away for half an hour and figured it out.
  var userIcon = document.createElement('img');
  userIcon.className = 'user-icon';
  userIcon.setAttribute('src', icon);
  $('.user-icon').wrap('<a href="' + link + '"></a>');
  user.appendChild(userIcon);
Rich Churcher
@richchurcher
Sep 20 2015 00:26
jQuery to the rescue huh? :)
Thomas Vaeth
@thomasvaeth
Sep 20 2015 00:26
Hah yup. @richchurcher Thank you for helping.
CamperBot
@camperbot
Sep 20 2015 00:26
thomasvaeth sends brownie points to @richchurcher :sparkles: :thumbsup: :sparkles:
:star: 309 | @richchurcher | http://www.freecodecamp.com/richchurcher
Matt Yamamoto
@MattYamamoto
Sep 20 2015 00:26
@thomasvaeth that works. brain breaks are great things.
Thomas Vaeth
@thomasvaeth
Sep 20 2015 00:26
@MattYamamoto Yeah. Thanks!
CamperBot
@camperbot
Sep 20 2015 00:26
thomasvaeth sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 340 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
Rich Churcher
@richchurcher
Sep 20 2015 00:27
yw. I always say, the ping pong table is the best troubleshooting device ever invented
solved so many problems that way
Thomas Vaeth
@thomasvaeth
Sep 20 2015 00:29
I actually had to change it. All the links were the same. I just changed '.user-icon' to userIcon.
Now I just need to figure out if the user returns undefined I just remove them from the array.
Yago Ferrer
@yagoferrer
Sep 20 2015 00:33
you don't need JQuery to wrap a link
var link = "http://www.google.com/";
var icon = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
var userIcon = document.createElement('img');
userIcon.className = 'user-icon';
userIcon.setAttribute('src', icon);
var a = document.createElement('a');
a.appendChild(userIcon);
a.href = link;
document.body.appendChild(a);
Thomas Vaeth
@thomasvaeth
Sep 20 2015 00:37
@yagoferrer I'll check it too. Thanks.
CamperBot
@camperbot
Sep 20 2015 00:37
thomasvaeth sends brownie points to @yagoferrer :sparkles: :thumbsup: :sparkles:
:star: 23 | @yagoferrer | http://www.freecodecamp.com/yagoferrer
ramireznoe01
@ramireznoe01
Sep 20 2015 00:49
function replace(str, before, after) {
  // Find index where before is on string
  var index = str.indexOf(before);
  // Check to see if the first letter is uppercase or not
  if (str[index] === str[index].toUpperCase()) {
    // Change the after word to be capitalized before we use it.
    after = after.charAt(0).toUpperCase() + after.slice(1);
  }
  // Now replace the original str with the edited one.
  str = str.replace(before, after);

  return str;
}
what is the purpose of "after.slice(1);" ?
Matt Yamamoto
@MattYamamoto
Sep 20 2015 00:51
@ramireznoe01 it gives you the rest of the word, which is then added to the capitalized fist letter
DJ Runas
@djrunas
Sep 20 2015 00:51
Yup.
It will slice starting at index 1 (which is the index after 0, or, the first letter which would be capitalized) and then concatenate that with the capitalized first letter.
Matt Yamamoto
@MattYamamoto
Sep 20 2015 00:53
From MDN: The slice() method extracts a section of a string and returns a new string. str.slice(beginSlice[, endSlice])
ramireznoe01
@ramireznoe01
Sep 20 2015 00:53
but it only has one number in it
Matt Yamamoto
@MattYamamoto
Sep 20 2015 00:53
that just means it goes to the end
DJ Runas
@djrunas
Sep 20 2015 00:54
So, .slice(1) would start at index 1 and continue until the end of the string.
.slice(2) would start at index 2 and so forth.
Jake Bryant
@jbryant8706
Sep 20 2015 00:57
function palindrome(str) {
 var re = /[^a-z0-9]/gi; 
  var checkWords=str.replace(' ').lowerCase(' '); 
  return checkWords;
}



palindrome("eye");
What's wrong this code?
Matt Yamamoto
@MattYamamoto
Sep 20 2015 00:58
well. . .for starters I think you're looking for str.toLowerCase()
what is your re variable for?
DJ Runas
@djrunas
Sep 20 2015 00:59
You also need to figure out a way to utilize your variable “re” as, in its current state, is not being used anywhere.
ramireznoe01
@ramireznoe01
Sep 20 2015 01:01
thx campers for the help
CamperBot
@camperbot
Sep 20 2015 01:01
if you want to thank someone, put an @ before their name!
Jake Bryant
@jbryant8706
Sep 20 2015 01:02
I am trying to figure how I get the given string to be expected true
@djrunas I am trying to figure how I get the given string to be expected true
Yago Ferrer
@yagoferrer
Sep 20 2015 01:04
@jbryant8706 send the link of the exercise you are lookint at...
DJ Runas
@djrunas
Sep 20 2015 01:04
I believe he’s working on the Palindromes bonfire.
Jake Bryant
@jbryant8706
Sep 20 2015 01:05
@yagoferrer this is Palindromes bonfire
Matt Yamamoto
@MattYamamoto
Sep 20 2015 01:05
@jbryant8706 This is a very methodical bonfire... talk (or think) through every step required to determine if a word is a palindrome.
almost everybody gets stuck trying to do too much at once.
Jake Bryant
@jbryant8706
Sep 20 2015 01:07
@MattYamamoto So, how to think every step by step to show it?
Yago Ferrer
@yagoferrer
Sep 20 2015 01:07
@jbryant8706 first reverse the word
and do an IF statement if equals to the original word
if that's true, return true :)
Matt Yamamoto
@MattYamamoto
Sep 20 2015 01:08
@jbryant8706 , just like @yagoferrer is saying. . .the first thing you would have to do is reverse the word. But to code that you need to break it down even more. . . how are you going to reverse the word? What needs to be done to accomplish that?
Yago Ferrer
@yagoferrer
Sep 20 2015 01:10
tip: words are hard to revert but arrays are easier
Jake Bryant
@jbryant8706
Sep 20 2015 01:13
@MattYamamoto Thanks!
CamperBot
@camperbot
Sep 20 2015 01:13
jbryant8706 sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 341 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
Jake Bryant
@jbryant8706
Sep 20 2015 01:14
@yagoferrer Thanks!
CamperBot
@camperbot
Sep 20 2015 01:14
jbryant8706 sends brownie points to @yagoferrer :sparkles: :thumbsup: :sparkles:
:star: 24 | @yagoferrer | http://www.freecodecamp.com/yagoferrer
Jake Bryant
@jbryant8706
Sep 20 2015 01:17
@all I have a question for you
How can I improve my writing codes?
DJ Runas
@djrunas
Sep 20 2015 01:17
Practice :)
Jake Bryant
@jbryant8706
Sep 20 2015 01:18
What's like practice
@djrunas what kind of practice I need to write code
Matt Yamamoto
@MattYamamoto
Sep 20 2015 01:18
exactly what you're doing
DJ Runas
@djrunas
Sep 20 2015 01:18
What @MattYamamoto said.
Matt Yamamoto
@MattYamamoto
Sep 20 2015 01:19
just keep at it... every day... and you'll be suprised how quickly you start to pick things up and get into the mindset
DJ Runas
@djrunas
Sep 20 2015 01:19
The important thing is to keep trekking along.
Don’t stop.
Jake Bryant
@jbryant8706
Sep 20 2015 01:19
@MattYamamoto
DJ Runas
@djrunas
Sep 20 2015 01:19
Practice can be whatever you want.
Continue on FCC.
Getting exercises from a textbook.
Reading documentation.
As long as you don’t quit, your code will definitely improve over time.
I guarantee it.
Jake Bryant
@jbryant8706
Sep 20 2015 01:21
@MattYamamoto, @djrunas Is it enough to spend on writing code every two hours in a day?
Matt Yamamoto
@MattYamamoto
Sep 20 2015 01:21
yes
DJ Runas
@djrunas
Sep 20 2015 01:21
Of course!
Jake Bryant
@jbryant8706
Sep 20 2015 01:21
@MattYamamoto , @djrunas how many hours you practice it?
DJ Runas
@djrunas
Sep 20 2015 01:22
I’m actually a newbie myself. Only been coding for the past 2 weeks.
Jake Bryant
@jbryant8706
Sep 20 2015 01:22
@MattYamamoto what's average?
@djrunas welcome to FCC! You had experience it before?
Matt Yamamoto
@MattYamamoto
Sep 20 2015 01:23
haha... no idea.
Jake Bryant
@jbryant8706
Sep 20 2015 01:23
Ha ha
DJ Runas
@djrunas
Sep 20 2015 01:23
I’ve seen FCC, but this if my first time delving into it.
Jake Bryant
@jbryant8706
Sep 20 2015 01:23
@MattYamamoto Thanks for bringing it up!
DJ Runas
@djrunas
Sep 20 2015 01:23
I’m going to have a lull these next few months, so I decided to place all of that time into this.
CamperBot
@camperbot
Sep 20 2015 01:23
jbryant8706 sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:warning: jbryant8706 already gave mattyamamoto points
DJ Runas
@djrunas
Sep 20 2015 01:24
How are you enjoying FCC so far, @jbryant8706 ?
Jake Bryant
@jbryant8706
Sep 20 2015 01:24
@djrunas I am very enjoying at learning what I am.
DJ Runas
@djrunas
Sep 20 2015 01:25
That’s good! :)
Brian Farias Tavares
@btav
Sep 20 2015 01:25
Great thing about FCC is that it helps build your portfolio.. Unless you've got some work experience... A solid portfolio will really help you find a job.
Matt Yamamoto
@MattYamamoto
Sep 20 2015 01:26
@jbryant8706 as long as you're having fun you'll get better. It's when people start to get really frustrated that they start to give up... that's why these chat rooms are great, so you don't feel like it's impossible.
DJ Runas
@djrunas
Sep 20 2015 01:26
^^
I made coding my New Year’s Resolution this year.
But I always started and stopped whenever I hit a wall.
Jake Bryant
@jbryant8706
Sep 20 2015 01:27
@MattYamamoto Exactly I was so frustrated how I struggled at basic script
DJ Runas
@djrunas
Sep 20 2015 01:27
Pair programming and this have definitely helped me a lot.
Oh, don’t worry, @jbryant8706 I went through the same thing!
For some of the Basic Algorithm Scripting I got a little frustrated because , “If I can’t understand these ones, how am I going to get through the intermediate ones and so forth?"
But, having a support system to help guide you through whenever you need help has been - what I found - invaluable to learning and getting you through those walls.
Jason Wood
@catapixel
Sep 20 2015 01:30
@jbryant8706 I would write out your solutions and then as people in the FreeCodeCamp/CodeReview to help you understand how you could have coded your solution better/differently.
Tommy Izen
@TommyIzen
Sep 20 2015 01:32
@djrunas That's normal, it's part of the learning process
The algorithms force you to do things you haven't used before
DJ Runas
@djrunas
Sep 20 2015 01:33
Ya, but, I just wasn’t used to going through these walls.
Sometimes I would push through for days, but still nothing seemed to get through.
Tommy Izen
@TommyIzen
Sep 20 2015 01:33
granted I have a full time job and married and go to church 3 times a week
but that was frustrating
DJ Runas
@djrunas
Sep 20 2015 01:33
wut
Tommy Izen
@TommyIzen
Sep 20 2015 01:34
lol gitter is trolling me again
CamperBot
@camperbot
Sep 20 2015 01:34
:trollface: troll problems? notify admins here
DJ Runas
@djrunas
Sep 20 2015 01:34
Kappa.
Tommy Izen
@TommyIzen
Sep 20 2015 01:34
I said I was stuck on the Title Case bonfire
DJ Runas
@djrunas
Sep 20 2015 01:34
Nah, but I understand what you were saying @TommyIzen
Tommy Izen
@TommyIzen
Sep 20 2015 01:34
for 3 weeks
DJ Runas
@djrunas
Sep 20 2015 01:34
I’m still stuck on seek and destroy.
I just, for some reason, can not understand the Arguments object or .filter().
DTing
@dting
Sep 20 2015 01:35
@jbryant8706 I have some notes on the basic bonfires here. https://github.com/dting/fccbonfires I feel like a lot of people move along the bf's without learning some of the fundamental constructs of coding. I emphasized using loops so you can walk through the control flow and logic that might help with the later ones.
DJ Runas
@djrunas
Sep 20 2015 01:35
Or, how to utilize them together for that matter.
Tommy Izen
@TommyIzen
Sep 20 2015 01:35
I'm not on that one yet.
My problem was that I had never used a for loop that way before
DJ Runas
@djrunas
Sep 20 2015 01:36
@dting, thanks for posting!
CamperBot
@camperbot
Sep 20 2015 01:36
djrunas sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1213 | @dting | http://www.freecodecamp.com/dting
DJ Runas
@djrunas
Sep 20 2015 01:36
Going to go through this documentation.
Because some of the bonfires I sort of just bashed my keyboard on until they produced the correct output.
Tommy Izen
@TommyIzen
Sep 20 2015 01:36
lol
DJ Runas
@djrunas
Sep 20 2015 01:36
But, some of the constructs may have not been fully understood.
Tommy Izen
@TommyIzen
Sep 20 2015 01:36
as long as you don't bash your face
DJ Runas
@djrunas
Sep 20 2015 01:36
:P
Let me look at Title Case again.
And see the implementation of a for loop.
Ah, yes.
DTing
@dting
Sep 20 2015 01:37
Ya the functional solutions are great, but really i feel like you should know what "indexOf" etc, is doing under the hood before using it.
DJ Runas
@djrunas
Sep 20 2015 01:37
Oh, god.
The bonfire with .indexOf() made me really sad.
Tommy Izen
@TommyIzen
Sep 20 2015 01:38
I understood indexOf pretty quickly, but I struggled figuring out how to increment it
DJ Runas
@djrunas
Sep 20 2015 01:38
^^
This.
@dting , this is really great.
Tommy Izen
@TommyIzen
Sep 20 2015 01:38
I ended up unshifting an array into an empty array, making that into a string, then reversing it
lol
DJ Runas
@djrunas
Sep 20 2015 01:39
LOL
Are you on falsy bouncer right now, @TommyIzen ?
henry fritz
@henryamster
Sep 20 2015 01:39
Question: in bf everything be true, is it necessary to set up a counter ? I don't really understand why this wouldn't work:
function every(collection, pre) { for (teletubbies in collection){ if (!teletubbies.hasOwnProperty(pre)) {return false;}} return true; }
DJ Runas
@djrunas
Sep 20 2015 01:39
help format
CamperBot
@camperbot
Sep 20 2015 01:39

: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 20 2015 01:40
Oh, wait.
Tommy Izen
@TommyIzen
Sep 20 2015 01:40
I'm on the bonfire where you return the larged number in the sub arrays
DJ Runas
@djrunas
Sep 20 2015 01:40
Ah, I see.
Tommy Izen
@TommyIzen
Sep 20 2015 01:41
I don't think you need to type js or html
just three ticks
DJ Runas
@djrunas
Sep 20 2015 01:42
Oh, really?
henry fritz
@henryamster
Sep 20 2015 01:42
js/html just give formatting hints in the context of your code
Rich Churcher
@richchurcher
Sep 20 2015 01:42
thanks @dting that's some crazy detail in those notes :)
DJ Runas
@djrunas
Sep 20 2015 01:42
Interesting.
CamperBot
@camperbot
Sep 20 2015 01:42
richchurcher sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1214 | @dting | http://www.freecodecamp.com/dting
DJ Runas
@djrunas
Sep 20 2015 01:42
Oh, yeah, dting.
This is a super excellent resource.
I’m going through some past bonfires and reading through your notes to cement concepts in.
And see what areas I need to delve into further.
Tommy Izen
@TommyIzen
Sep 20 2015 01:43
<html>
<head>
</head>
<body>
<script>
alert("Not Necessary : )");
</script>
</body>
</html>
@dting If I read your notes, they don't spoil the solutions for me do they? : )
Rory Smith
@alanbuchanan
Sep 20 2015 01:46
Screen Shot 2015-09-20 at 02.45.28.png
so guys what am i doing wrong and how can i solve it?
app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {

    var url = 'https://en.wikipedia.org/w/api.php?format=json&action=query&list=search&srsearch=stuff&srwhat=text&srprop=timestamp&continue=';

    $http.get(url).success(function(data){
        $scope.a = data;
    });
}]);
CamperBot
@camperbot
Sep 20 2015 01:46
:trollface: troll problems? notify admins here
Jason Wood
@catapixel
Sep 20 2015 01:47
@alanbuchanan you have to use jsonp if you want to access another domain...
Tommy Izen
@TommyIzen
Sep 20 2015 01:47
or use a proxy server
Rory Smith
@alanbuchanan
Sep 20 2015 01:48
i tried using $http.jsonp() and i get the following error:
Refused to execute script from 'https://en.wikipedia.org/w/api.php?format=json&action=query&list=search&srsearch=stuff&srwhat=text&srprop=timestamp&continue=' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
Jason Wood
@catapixel
Sep 20 2015 01:48
ajax doesn't allow you, for security reasons, to access other sites all by itself. jsonp is a workaround
Rory Smith
@alanbuchanan
Sep 20 2015 01:48
sorry but this http stuff is greek to me
Jason Wood
@catapixel
Sep 20 2015 01:49
@alanbuchanan your line isn't formatted correctly I believe. I'm still working it all out myself but I believe you need a callback function on the end and possibly a couple other things. I'm just looking quickly at what you pasted...
try adding &callback=? to the end of the url
you might also need to change your format=json to format=jsonp
Rory Smith
@alanbuchanan
Sep 20 2015 01:53
that &callback=? seems to do the trick
after having read up on CORS for ages i feel dumb that that solves it :)
@catapixel thanks
CamperBot
@camperbot
Sep 20 2015 01:54
alanbuchanan sends brownie points to @catapixel :sparkles: :thumbsup: :sparkles:
:star: 378 | @catapixel | http://www.freecodecamp.com/catapixel
Yan Kozlovskiy
@YanKozlovskiy
Sep 20 2015 02:52
noStroke();
// the beautiful blue sky
background(82, 222, 240);

// the starting size for the sun
var sunSize = 30; 

var draw = function() {
sunSize += 1;

// The sun, a little circle on the horizon
fill(255, 204, 0);
ellipse(200, 298, sunSize, sunSize);

// The land, blocking half of the sun
fill(76, 168, 67);
rect(0, 300, 400, 100);
};
how does sun keep increasing? i thought a function executes once unless it's part of a loop... where's the loop???
Hans van Riet
@hansinla
Sep 20 2015 02:59
@YanKozlovskiy everytime you call draw the sunsize increases or is that not what you mean?
Yan Kozlovskiy
@YanKozlovskiy
Sep 20 2015 03:00
yes, that's the entire code
i'm learning how animations work on khan academy
Hans van Riet
@hansinla
Sep 20 2015 03:00
@YanKozlovskiy Where do you call draw though
Matt Everson
@matteverson
Sep 20 2015 03:00
@YanKozlovskiy Draw is probably in some kind of loop for animation.
Yan Kozlovskiy
@YanKozlovskiy
Sep 20 2015 03:00
that's what i would like to know
shouldn't it be in some kind of function?
Matt Everson
@matteverson
Sep 20 2015 03:01
None of those other calls are vanilla-JS functions, so you already know there's libraries at work outside of this.
Yan Kozlovskiy
@YanKozlovskiy
Sep 20 2015 03:01
okay thanks
CamperBot
@camperbot
Sep 20 2015 03:01
if you want to thank someone, put an @ before their name!
Yan Kozlovskiy
@YanKozlovskiy
Sep 20 2015 03:01
i guess those tutorials are too basic for me :(
Matt Everson
@matteverson
Sep 20 2015 03:01
They're hiding some stuff from you
@YanKozlovskiy I like phaser: http://phaser.io/examples
Yan Kozlovskiy
@YanKozlovskiy
Sep 20 2015 03:03
phaser is excellent! thanks @matteverson :)
CamperBot
@camperbot
Sep 20 2015 03:03
yankozlovskiy sends brownie points to @matteverson :sparkles: :thumbsup: :sparkles:
:star: 383 | @matteverson | http://www.freecodecamp.com/matteverson
Michael Cheung
@m6cheung
Sep 20 2015 03:09
can someone take a look at my code and tell me why it doesn't return anything? I'm trying to find the longest word while using a callback function:
var res = "";
function longest(sen, callback) {
sen = sen.split(" ");
  for(var i = 0; i < sen.length; i++) {
  callback(sen[i]);
}
}

function findLongest(item) {
 if(item.length > res.length) {
  res = item;
}
return res;
}

longest("I love dogs",findLongest);
Dona Hertel
@cocofan
Sep 20 2015 03:10
I'm working on Zipline for camper news and I'm trying to use JSONP because Firefox won't let me use JSON (a security risk of some sort). My code for calling the Camper News url () $http({
url: getUrl,
method: 'JSONP'
}).success(function(data) {
deferred.resolve(data);
}).error(function() {
deferred.reject("error getting data");
});
I'm getting an error message:Refused to execute script from 'http://www.freecodecamp.com/news/hot' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled. " I'm not sure how to get around this.
Hans van Riet
@hansinla
Sep 20 2015 03:19
@m6cheung Is this for the findLongestWord challenge? You need to return the length of the longest word, not the word itself.
Michael Cheung
@m6cheung
Sep 20 2015 03:23
@hansinla ok, how about this then, it still doesn't return anything.
var res = "";
function longest(sen, callback) {
sen = sen.split(" ");
  for(var i = 0; i < sen.length; i++) {
  callback(sen[i]);
}
}

function findLongest(item) {
 if(item.length > res.length) {
  res = item;
}
return res.length;
}

longest("I love dogs",findLongest);
Kevin Diem
@kgdiem
Sep 20 2015 03:23
Hey, doing Bonfire: Roman Numeral Converter, wondering if my answer is appropriate? I kind of feel like its cheating to solve for the test cases rather than making it work for a wider variety of cases
function convert(num) {
var arr = ["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI","XVII","XVIII","XIX","XX","XXI","XXII","XXIII","XXIV","XXV","XXVI","XXVII","XXVIII","XXIX","XXX"];
 return arr[num-1];
}

convert(5);
Hans van Riet
@hansinla
Sep 20 2015 03:23
@cocofan I use XMLHttpRequest() and have none of your issues.
Kevin Diem
@kgdiem
Sep 20 2015 03:24
@cocofan if you would like to post your AJAX request I can help you, was struggling with it for like 3 days.
It is a lot simpler than XMLHttpRequest() IMO
Hans van Riet
@hansinla
Sep 20 2015 03:25
@m6cheung TBH, I can’t follow your code at all. Just iterate over the words and keep track of the value of the max length.
Michael Cheung
@m6cheung
Sep 20 2015 03:26
@hansinla i know theres a much easier way to solve this and I've done it already, but I want to implement it using callback functions because my interviewer asked mea very similar question yesterday and he wanted it done using callbacks to show my knowledge of callbacks
@hansinla i couldn't figure out why my function wouldn't return anything unless I call res; at the end
Hans van Riet
@hansinla
Sep 20 2015 03:30
@m6cheung but you call longest, so the return should be in the longest function, not in findlongest
@m6cheung To use a callback function, I would use functional programming in this case.
Michael Cheung
@m6cheung
Sep 20 2015 03:32
@hansinla i get it..., what do you mean by functional programming? like using map reduce filter?
Hans van Riet
@hansinla
Sep 20 2015 03:32
@m6cheung yes
Michael Cheung
@m6cheung
Sep 20 2015 03:33
@hansinla yea I asked him if I oculd use reduce map filter he said no, do it from scratch
@hansinla "show me you know what's going on underneath those methods"
@hansinla thats what i got
Hans van Riet
@hansinla
Sep 20 2015 03:35
@m6cheung What goes on underneath those functions are loops.
Dona Hertel
@cocofan
Sep 20 2015 03:36

@kgdiem I'm using $http in AngularJS. I guess I could just use the XMLHttpRequest from Javascript but I would like to learn AngularJS coding. The request is in the previous post but I have it below

$http({
                     url: getUrl,
                     method: 'JSONP'
                     }).success(function(data) {
                         deferred.resolve(data);
                 }).error(function() {
                     deferred.reject("error getting data");
                 });

I'm also using promises so maybe that might be the problem.

Is it possible to use HTML when chatting?
Hans van Riet
@hansinla
Sep 20 2015 03:37
wiki format
CamperBot
@camperbot
Sep 20 2015 03:37

: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

Dona Hertel
@cocofan
Sep 20 2015 03:38
@camperbot thank you!
CamperBot
@camperbot
Sep 20 2015 03:38
cocofan sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 243 | @camperbot | http://www.freecodecamp.com/camperbot
Ankit Singh
@theleancoder
Sep 20 2015 03:41
This message was deleted
This message was deleted
CamperBot
@camperbot
Sep 20 2015 03:41
:bulb: to format code use backticks! ``` more info
Ankit Singh
@theleancoder
Sep 20 2015 03:42
This message was deleted
Rich Churcher
@richchurcher
Sep 20 2015 03:42
@theleancoder put the backticks on their own lines
Ankit Singh
@theleancoder
Sep 20 2015 03:43
you mean on every line?
Rich Churcher
@richchurcher
Sep 20 2015 03:43
nope, just to start and finish
Kevin Diem
@kgdiem
Sep 20 2015 03:44
You can't just use $.get(freecodecamp.com).done(function(){}); ?
@cocofan
Rich Churcher
@richchurcher
Sep 20 2015 03:44
```
like this
```
hah didn't work, oh well :)
Ankit Singh
@theleancoder
Sep 20 2015 03:44
let me try again...
Rich Churcher
@richchurcher
Sep 20 2015 03:44
you get the picture
gitter obviously doesn't like nested backticks
a1rr0wh3ad
@a1rr0wh3ad
Sep 20 2015 03:45
@cocofan try method: jsonp or $http.jsonp(getUrl)
Dona Hertel
@cocofan
Sep 20 2015 03:46
@kgdiem I need to return the data to the controller. But with a callback I can't get the controller code to wait for a return value.
CamperBot
@camperbot
Sep 20 2015 03:46
:trollface: troll problems? notify admins here
Ankit Singh
@theleancoder
Sep 20 2015 03:46
function truncate(str, num) {
  // Clear out that junk in your trunk
  return str.slice(0, -(str.length - (num + 3))).concat("...");
}

truncate("A-tisket a-tasket A green and yellow basket", 11, "");

what's wrong with this code?

Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a "..." ending.

Rich Churcher
@richchurcher
Sep 20 2015 03:47
:+1:
Dona Hertel
@cocofan
Sep 20 2015 03:48
Let try the get or jsonp functions for now.
Hans van Riet
@hansinla
Sep 20 2015 03:49
@theleancoder You have to test if the string is longer than num before you apply your code. Also look at the parameters in your slice function.
Rich Churcher
@richchurcher
Sep 20 2015 03:49
Well for one thing, you don't check to see if the string is longer than 11 characters
you only want to truncate if it's longer
Ankit Singh
@theleancoder
Sep 20 2015 03:50
function truncate(str, num) {
  // Clear out that junk in your trunk
  if(str.length > num) {
  return str.slice(0, -(str.length - (num + 3))).concat("...");
  }
}

truncate("A-tisket a-tasket A green and yellow basket", 11, "");
still not passing the tests
Hans van Riet
@hansinla
Sep 20 2015 03:52
@theleancoder you make it too complicated with -(str.length - (num + 3))
SojournerOctocat
@SojournerOctocat
Sep 20 2015 03:52
@theleancoder The string length is 43. You're slicing off 11+3 characters from the end of the string when the string is supposed to equal 11 characters (including 3 characters for the ....
Farhad ali
@alifarhad
Sep 20 2015 04:02
@theleancoder you need to truncate your string but the three dotes ... should add to your truncated string lenght. i.e. your truncated string should have the length of 9 so when you add ... to it. it would make 11 in total
Ankit Singh
@theleancoder
Sep 20 2015 04:06
thanks everyone :)
CamperBot
@camperbot
Sep 20 2015 04:06
if you want to thank someone, put an @ before their name!
Farhad ali
@alifarhad
Sep 20 2015 04:08
thanks @camperbot
CamperBot
@camperbot
Sep 20 2015 04:08
alifarhad sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 244 | @camperbot | http://www.freecodecamp.com/camperbot
Will Seymour
@wseymour
Sep 20 2015 04:31
Would someone mind telling me what they think of this profile page? http://codepen.io/wseymour/pen/zvBYvB
Ooh. It looks terrible on here
Bitra Balachandra Tejaswi
@BalachandraTejas
Sep 20 2015 04:43
Looks good @webdevjeffus . May I suggest a few things if you won't mind
Will Seymour
@wseymour
Sep 20 2015 05:00
Sorry, that was the wrong link. Here's the full page preview: http://codepen.io/wseymour/full/zvBYvB
Michael Cheung
@m6cheung
Sep 20 2015 05:31
can someone tell me why this doesnt work?
function VowelCount(str,callback) { 
var vowHolder = [];
var vow = /[aeiou]/;
  for(var i = 0; i < str.length; i++) {
  callback(str[i]);
  }
return vowHolder.length;
}

    function findVows(string) {
      if(vow.test(string)) {
        vowHolder.push(string);  
      }
    }
but this does?
var vowHolder = [];
var vow = /[aeiou]/;
function VowelCount(str,callback) { 
  for(var i = 0; i < str.length; i++) {
  callback(str[i]);
  }
return vowHolder.length;
}

    function findVows(string) {
      if(vow.test(string)) {
        vowHolder.push(string);  
      }
    }
a1rr0wh3ad
@a1rr0wh3ad
Sep 20 2015 05:34
@m6cheung in the first code, vowHolder and vow are only defined inside the function VowelCount, so they can't be accessed inside the function findVows. On the second code, vowHolder and vow are global variables so they can be accessed anywhere. See: http://www.w3schools.com/js/js_scope.asp
Luis Felipe López G.
@luishendrix92
Sep 20 2015 05:34
what's "callback" supposed to do?
Michael Cheung
@m6cheung
Sep 20 2015 05:36
@a1rr0wh3ad but isn't findVows called within VowelCount, making findVows a closure and thus having access to the vars defined on the outer function?
@luishendrix92 it is a function that will be called at a later time within another function by being passed as a parameter to the other function
Kevin Diem
@kgdiem
Sep 20 2015 05:37
Can someone check out my pen for pomodoro clock? I have the timer & it works but doesn't update unless I keep clicking the clock face
http://codepen.io/kgdiem/pen/pjbJMX
Luis Felipe López G.
@luishendrix92
Sep 20 2015 05:37
If I wanted to do a vowel counter I'd do something like
var str = "A lazy dog jumps over the quick brown fox";
function vowelCounter(phrase) {
  return phrase.match(/[aeiou]/gi).length;
} // End of vowel counter

console.log(vowelCounter(str))
// --> 11
@m6cheung Yeah but I wanted to know what it does in this particular vowel counter case.
Michael Cheung
@m6cheung
Sep 20 2015 05:37
@luishendrix92 i know theres easy ways to do vowel counting, but I wanted to impleent callback functions
a1rr0wh3ad
@a1rr0wh3ad
Sep 20 2015 05:38
@m6cheung where is findVows called within VowelCount?
Luis Felipe López G.
@luishendrix92
Sep 20 2015 05:39
Yeah, I didn't see any calls to findVows inside the other function, nor I saw any execution of any function, just declarations.
Michael Cheung
@m6cheung
Sep 20 2015 05:40
@a1rr0wh3ad here let me write it like this so it's easier to follow:
var vowHolder = [];
var vow = /[aeiou]/;
function VowelCount(str, function hello(string) {
if(vow.test(string)) {
vowHolder.push(string);
}
}) { 
  for(var i = 0; i < str.length; i++) {
  hello(str[i]);
  }
return vowHolder.length;
}
@m6cheung i dont know if that makes it easier or harder
Luis Felipe López G.
@luishendrix92
Sep 20 2015 05:40
VowelCount('abcde', findVows) in chrome's console works fine for me:
2
Michael Cheung
@m6cheung
Sep 20 2015 05:41
@luishendrix92 did it work for the 2nd one too?
@luishendrix92 i mean the first one
Woolwit
@Woolwit
Sep 20 2015 05:42
Confused about the first Zipline, Build a Personal Portfolio. You're given the option to (which I did) "... fork this simple Bootstrap portfolio template on CodePen: http://codepen.io/FreeCodeCamp/pen/mJNqQj." But there's no CSS in the CSS bin. There's CSS there somewhere, but... how to move forward with editing CSS?
Luis Felipe López G.
@luishendrix92
Sep 20 2015 05:42
First one:

Uncaught ReferenceError: vow is not defined(…)

That's because vow doesn't exists within the scope of the findVows function.
Michael Cheung
@m6cheung
Sep 20 2015 05:42
@luishendrix92 right, but according to the rules of closure shouldnt it?
Luis Felipe López G.
@luishendrix92
Sep 20 2015 05:43
You are using local functions, therefore there's no global "vow" var
Michael Cheung
@m6cheung
Sep 20 2015 05:43
@luishendrix92 findVows will take the place of callback and then be called inside of VowelCount right?
Luis Felipe López G.
@luishendrix92
Sep 20 2015 05:44
Maybe if you put the function findVows indie the main function it'll work
closures, otherwise, are invalid.
nvm I tried and didn't work
because it's still asking for callback, err I'm making a mess lol
a1rr0wh3ad
@a1rr0wh3ad
Sep 20 2015 05:47
@m6cheung Can you show the entire code? It isn't clear what function is actually being called.
@m6cheung From what is show, it looks like there is no connection between VowelCount and findVows.
Michael Cheung
@m6cheung
Sep 20 2015 05:48
var vowHolder = [];
var vow = /[aeiou]/;
function VowelCount(str,callback) { 
  for(var i = 0; i < str.length; i++) {
  callback(str[i]);
  }
return vowHolder.length;
}

    function findVows(string) {
      if(vow.test(string)) {
        vowHolder.push(string);  
      }
    }
VowelCount("hello", findVows);
@a1rr0wh3ad
a1rr0wh3ad
@a1rr0wh3ad
Sep 20 2015 05:48
Oh I get it
Michael Cheung
@m6cheung
Sep 20 2015 05:48
@a1rr0wh3ad sorry bout that
santiagoRaffa
@santiagoRaffa
Sep 20 2015 05:53
hi!
i need some help with an exercise..
is this one: Bonfire: Seek and Destroy

function destroyer(arr) {
// Remove all the values
var myArray = [];
args = arguments.length - 1;

for(var i = 0; i<arr.length; i++){
for(var x = 1; x<args; x++){
if(arr[i] == arguments[x]){
delete arr[i];
}
}
}
for(var x=0; x<arr.length; x++){
if(arr[x] != null){
myArray.push(arr[x]);
}
}

console.log(myArray);
return myArray;
}

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

someone?
Luis Felipe López G.
@luishendrix92
Sep 20 2015 05:57

Ok so, written like this, it works:

function VowelCount(str,callback) {
    var vowHolder = [];
    var vow = /[aeiou]/;
    function findVows(string) {
        if(vow.test(string))
            vowHolder.push(string);
    }

    for(var i = 0; i < str.length; i++)
        findVows(str[i]);

    return vowHolder.length;
}

VowelCount("hello", findVows);

Re-Written as this (using arguments to link the scopes):

function VowelCount(str,callback) {
    var vowHolder = [];
    var vow = /[aeiou]/;
    for(var i = 0; i < str.length; i++) {
        callback(str[i], vowHolder, vow);
    }

    return vowHolder.length;
}

function findVows(string, holder, testCase) {
  if(testCase.test(string)) {
    holder.push(string);  
  }
}

VowelCount("hello", findVows);

Also works

@santiagoRaffa Format your code better:
wiki format
CamperBot
@camperbot
Sep 20 2015 05:57

: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

santiagoRaffa
@santiagoRaffa
Sep 20 2015 05:59
```

function destroyer(arr) {
// Remove all the values
var myArray = [];
args = arguments.length - 1;

for(var i = 0; i<arr.length; i++){
for(var x = 1; x<args; x++){
if(arr[i] == arguments[x]){
delete arr[i];
}
}
}
for(var x=0; x<arr.length; x++){
if(arr[x] != null){
myArray.push(arr[x]);
}
}

console.log(myArray);
return myArray;
}

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

```
```

function destroyer(arr) {
// Remove all the values
var myArray = [];
args = arguments.length - 1;

for(var i = 0; i<arr.length; i++){
for(var x = 1; x<args; x++){
if(arr[i] == arguments[x]){
delete arr[i];
}
}
}
for(var x=0; x<arr.length; x++){
if(arr[x] != null){
myArray.push(arr[x]);
}
}

console.log(myArray);
return myArray;
}

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

```
Luis Felipe López G.
@luishendrix92
Sep 20 2015 06:00
Should be in the same message
JeremyWBean
@JeremyWBean
Sep 20 2015 06:22
Evening, everyone! This is by no means finished but I was hoping a few of you could play with my TIC TAC TOE and see if you notice any problems. Thanks in advance. :smile: http://codepen.io/JeremyWBean/full/WQwXqx
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:25
blob
Epskip
@VivekBezawada
Sep 20 2015 06:25
$($('.slot')[0]).html('<img src = "' + images[slotOne-1] + '">');
$($('.slot')1).html('<img src = "' + images[slotTwo-1] + '">');
$($('.slot')[2]).html('<img src = "' + images[slotThree-1] + '">');
blob
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:26
tried the same but getting this error message:
Epskip
@VivekBezawada
Sep 20 2015 06:26
Anyone know how to solve the problem in the screenshot ?
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:27
blob
Epskip
@VivekBezawada
Sep 20 2015 06:28
@daksh844 I was able to run the code perfectly without getting any error
Jeremiah
@jerrydtm
Sep 20 2015 06:30

forgetting the bracket around the first 1 maybe?

should be
$($('.slot')1.html

Bitra Balachandra Tejaswi
@BalachandraTejas
Sep 20 2015 06:30
@VivekBezawada Have you tried escaping the forward slashes and back slashes in the regex
Jeremiah
@jerrydtm
Sep 20 2015 06:30
$($('.slot'[1].html
Epskip
@VivekBezawada
Sep 20 2015 06:31
I am having trouble solving "check for palindrome" question. I was unable to run the last test case.
@BalachandraTejas I was getting an error with underscore
Bitra Balachandra Tejaswi
@BalachandraTejas
Sep 20 2015 06:32
escape underscore with a backslash. example replace('/_/g','') unable to show back slash here..
Jeremiah
@jerrydtm
Sep 20 2015 06:35

@daksh844 your code should look like this...

`<script>
function runSlots(){
var slotOne;
var slotTwo;
var slotThree;

var images = ["http://i.imgur.com/9H17QFk.png", "http://i.imgur.com/9RmpXTy.png", "http://i.imgur.com/VJnmtt5.png"];

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')[0]).html('<img src = "' + images[slotOne-1] + '">');
$($('.slot')[1]).html('<img src = "' + images[slotTwo-1] + '">');
$($('.slot')[2]).html('<img src = "' + images[slotThree-1] + '">');`
Bitra Balachandra Tejaswi
@BalachandraTejas
Sep 20 2015 06:37
@camperbot how do i type code here. please help
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:38
@jerrydtm here is my screenshot below
Jeremiah
@jerrydtm
Sep 20 2015 06:38
hit the ~ key on your keyboard before and after your code
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:38
blob
Jeremiah
@jerrydtm
Sep 20 2015 06:38
should populate a " ` "
Bitra Balachandra Tejaswi
@BalachandraTejas
Sep 20 2015 06:38
thanks @jerrydtm
CamperBot
@camperbot
Sep 20 2015 06:38
balachandratejas sends brownie points to @jerrydtm :sparkles: :thumbsup: :sparkles:
:star: 173 | @jerrydtm | http://www.freecodecamp.com/jerrydtm
Bitra Balachandra Tejaswi
@BalachandraTejas
Sep 20 2015 06:39
@VivekBezawada try this
~
replace(/_/g, '');
~
Rex Schrader
@SaintPeter
Sep 20 2015 06:42
Thanks @smirciat for the Basejump help!
CamperBot
@camperbot
Sep 20 2015 06:42
saintpeter sends brownie points to @smirciat :sparkles: :thumbsup: :sparkles:
:star: 180 | @smirciat | http://www.freecodecamp.com/smirciat
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:43
@camperbot can you look into this:
Jeremiah
@jerrydtm
Sep 20 2015 06:44
@daksh844 need spaces before and after the " = " in your img src
$($('.slot')[0]).html('<img src = "' + images[slotOne-1] + '">');
you have $($('.slot')[0]).html('<img src="' + images[slotOne-1] + '">');
do that to all three lines
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:46
@jerrydtm nothing happened, its still the same
This is the error I'm getting "Use the provided code three times. One for each slot."
Epskip
@VivekBezawada
Sep 20 2015 06:47
@BalachandraTejas I tried that already. didn't help
Jeremiah
@jerrydtm
Sep 20 2015 06:47

yeah and i think i noticed why also...you need to make the code exactly as it is showed...

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

$($('.slot')[0]).html('<img src = "' + images[slotOne-1] + '">'); $($('.slot')[1]).html('<img src = "' + images[slotTwo-1] + '">'); $($('.slot')[2]).html('<img src = "' + images[slotThree-1] + '">');
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:48
although it's already written 3 times
Rex Schrader
@SaintPeter
Sep 20 2015 06:48
@daksh844 I suggest you start by copying and pasting the code 3 times. Then, when you change the variable name DON'T CHANGE ANY SPACING. It's REALLY picky. You have to have the exact spaces before and after the minus.
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:48
@SaintPeter exactly -but I only edited the variable name , copied the whole code 3 time
times*
Jeremiah
@jerrydtm
Sep 20 2015 06:49
delete your old code and paste above(only one line not both)
$($('.slot')[0]).html('<img src = "' + images[slotOne-1] + '">');
    $($('.slot')[1]).html('<img src = "' + images[slotTwo-1] + '">');
    $($('.slot')[2]).html('<img src = "' + images[slotThree-1] + '">');
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:50
@jerrydtm the above provided code worked but can you please explain me why?
as both of them was exactly same
Jeremiah
@jerrydtm
Sep 20 2015 06:50

copy and paste that

whats going wrong is you're missing the spaces before and after your equals sign and plus signs

same code but missing the spacing....
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:50
but the spacing doesn't matter I guess
or does it?
Jeremiah
@jerrydtm
Sep 20 2015 06:51
i have found that it actually does
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:51
cool thanks @jerrydtm
CamperBot
@camperbot
Sep 20 2015 06:51
daksh844 sends brownie points to @jerrydtm :sparkles: :thumbsup: :sparkles:
:star: 174 | @jerrydtm | http://www.freecodecamp.com/jerrydtm
Jeremiah
@jerrydtm
Sep 20 2015 06:51
im not 100% sure as to why and how yet because im still learning as well but just know that it does lol
anyone else actually know why the spacing matters? not "because it just does" either lol
Rex Schrader
@SaintPeter
Sep 20 2015 06:53
@jerrydtm The problem is that someone wrote a regular expression to check for the answer and it doesn't take into account actual allowed spacing.
Jeremiah
@jerrydtm
Sep 20 2015 06:53
so it actually doesnt matter about the spacing in a real world situation but here it does?
Rex Schrader
@SaintPeter
Sep 20 2015 06:54
@jerrydtm Precisely.
Jeremiah
@jerrydtm
Sep 20 2015 06:54
Awesome! lol.
Rex Schrader
@SaintPeter
Sep 20 2015 06:55
@jerrydtm Writing a test to check for code with the actual allowed variability of real world javascript is non-trivial.
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:55
@SaintPeter thanks for clarifying
CamperBot
@camperbot
Sep 20 2015 06:55
daksh844 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 662 | @saintpeter | http://www.freecodecamp.com/saintpeter
Deepanshu Kaushik
@daksh844
Sep 20 2015 06:55
guys if i try to solve other people
issue over here would I also get the brownie like you
Jeremiah
@jerrydtm
Sep 20 2015 06:56
I'm actually needing help now. bonfire: factorialize a number
CamperBot
@camperbot
Sep 20 2015 06:56
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Jeremiah
@jerrydtm
Sep 20 2015 06:57
factorialize a number
Rex Schrader
@SaintPeter
Sep 20 2015 06:57
@jerrydtm I can help
@jerrydtm Do you have any code or are you looking for where to start?
bf factorialize
CamperBot
@camperbot
Sep 20 2015 06:57

: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

Jeremiah
@jerrydtm
Sep 20 2015 06:58
not sure where to start.
Rex Schrader
@SaintPeter
Sep 20 2015 06:58
@jerrydtm Have you read up on what a factorial is?
Jeremiah
@jerrydtm
Sep 20 2015 06:58
ive looked at the "helpful links" but nothing actually says anything about "factoralize"
Epskip
@VivekBezawada
Sep 20 2015 06:58
@jerrydtm You should return the multiplication of the given number and the number preceeding to that
You do this iteration till num becomes 1
Rex Schrader
@SaintPeter
Sep 20 2015 06:59
@jerrydtm Here is a nice overview: http://www.purplemath.com/modules/factorial.htm
@jerrydtm In general: A factorial is the product of all integers preceeding a number. So 3 factorial = 1 * 2 * 3 = 6
Jeremiah
@jerrydtm
Sep 20 2015 07:00
OHHHH
okay standby
SaintPeter @SaintPeter humms "The Girl From Ipa Nima" while he waits.
Jeremiah
@jerrydtm
Sep 20 2015 07:02
okay so i put in (1 2 3 4 5) and the output came out as 120 like it asked but it still failed
Rex Schrader
@SaintPeter
Sep 20 2015 07:03
@jerrydtm Well, remember that you have to solve it in the general case. Meaning for an arbitrary input, what is the factorial?
Jeremiah
@jerrydtm
Sep 20 2015 07:03
5!
Rex Schrader
@SaintPeter
Sep 20 2015 07:03
@jerrydtm So you're going to have to come up with a way of looping through all of the numbers from 1 to num (or whatever the prameter name is)
@jerrydtm The test cases are to ensure that you didn't just "hard code" the solution and instead solve it like a programmer.
Jeremiah
@jerrydtm
Sep 20 2015 07:06
still lost....
im not asking for the answer cause i want to learn it.
i just dont understand what it is i need to do. if that makes sense
Rex Schrader
@SaintPeter
Sep 20 2015 07:07
@jerrydtm Ok, manually write out the way to calculate the solution for 4!, 5! and 6!
@jerrydtm IE: 1 * 2 * 3 * 4
Jeremiah
@jerrydtm
Sep 20 2015 07:07
1 x 2 x 3 x 4
1 x 2 x 3 x 4 x 5
1 x 2 x 3 x 4 x 5 x 6
Rex Schrader
@SaintPeter
Sep 20 2015 07:08
@jerrydtm Once you've done that, think about how you could produce the same output using javascript
@jerrydtm That sure looks like a sequence to me
@jerrydtm If you were going to do it from 1 to "num", how could you do that? What tools/structures in javascript look like that?
@jerrydtm Or produce output like that?
Todd Loiselle
@loiselt1
Sep 20 2015 07:12
Evening, all. Working on CSS Waypoint Prioritize One Style Over Another and I'm not sure why I feel so lost. It says to create a CSS class called pink-text that gives an element the color pink; then give my h1 element the class of pink-text. Wouldn't I do something along the lines of .pink-text {color: pink;} in my style and then do <h1 class="pink-text" .... </h1> ??
Rex Schrader
@SaintPeter
Sep 20 2015 07:12
@loiselt1 That sounds right.
@loiselt1 You will need to create the .pink-text class up in the <style> section.
Kris Gesling
@krisgesling
Sep 20 2015 07:13
@loiselt1 maybe just a little typo somewhere? Sounds like you've got the theory right
Rex Schrader
@SaintPeter
Sep 20 2015 07:14
@loiselt1 If that's not working, you can share your code here.
wiki format
CamperBot
@camperbot
Sep 20 2015 07:14

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Jeremiah
@jerrydtm
Sep 20 2015 07:14
so i think it should be var product = 1 * 2 * 3 * 4 ;
Rex Schrader
@SaintPeter
Sep 20 2015 07:14
@loiselt1 See instructions above ^^
Todd Loiselle
@loiselt1
Sep 20 2015 07:14
@SaintPeter that's what I thought. I will start over with that and try again and see what happens. Maybe I got something written goofy. After all, it is 2:14 here and it's only slightly past my bedtime lol.
Rex Schrader
@SaintPeter
Sep 20 2015 07:15
@jerrydtm Well, yes and no. The thing is that you're not actually going to have any numbers in the function. Everything will be in variables.
@jerrydtm Do you recall how to set up a for loop?
Jeremiah
@jerrydtm
Sep 20 2015 07:15
not of the top of my head but i can go back to it.
so i would just put ```js
var product =5!
Rex Schrader
@SaintPeter
Sep 20 2015 07:17
@jerrydtm Nope. Nothing like that. There is no "factorial" or ! function in Javascript. Actually the ! operator means "not" or "invert"
@jerrydtm Go back and take a look at how for loops work. Basic Javascript Waypoint 27 covers them. You absolutely need to understand them in order to complete the Bonfires.
Jeremiah
@jerrydtm
Sep 20 2015 07:22

then why does it say "Return the factorial of the provided integer.

If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.

Factorials are often represented with the shorthand notation n!"

Rex Schrader
@SaintPeter
Sep 20 2015 07:22
@jerrydtm All of those things are true. The shorthand notation is mathematical notation, not Javascript.
Jeremiah
@jerrydtm
Sep 20 2015 07:23
oh
Rex Schrader
@SaintPeter
Sep 20 2015 07:23
@jerrydtm It's also a pretty big hint on how to solve this problem . . .
Jeremiah
@jerrydtm
Sep 20 2015 07:24
ugh apparently the only hint i got was how to mathematically write it out
so on a loop i need it to be a for loop cause i want it to run 3 times
Rex Schrader
@SaintPeter
Sep 20 2015 07:25
@jerrydtm Remember: Programming is not just about solving the problem. Sometimes you need to learn something about the problem or the problem space and then be able to take that information back and translate it into code. For example, you might be working on an airline scheduling website. You may not know anything about airline schedules, but you better be prepared to learn if you're going to write good code for them. Most problems don't come with a handy "how to solve me" guide. I encourage you to take some time to learn more about factorials and how they work.
@jerrydtm Well, the loop is so you can count from 1 to n
@jerrydtm You can't really be thinking in terms of actual numbers, but in terms of variables. Think about how you solve it for ANY given number, not just a specific number.
Jeremiah
@jerrydtm
Sep 20 2015 07:27
but i have to give specific numbers cause that is what it asks for
assert(typeof(factorialize(5)) === "number", 'factorialize() should return a number.');
assert(factorialize(5) === 120, '5 should return 120.');5 should return 120.
assert(factorialize(10) === 3628800, '10 should return 3,628,800.');10 should return 3,628,800.
assert(factorialize(20) === 2432902008176640000, '20 should return 2,432,902,008,176,640,000.');20 should return 2,432,902,008,176,640,000.
assert(factorialize(0) === 1, '0 should return 1.');0 should return 1.
Rex Schrader
@SaintPeter
Sep 20 2015 07:27
@jerrydtm Nope. It doesn't. The tests are there to test that it works for a bunch of different numbers.
@jerrydtm But you need to solve it "in the general case" - meaning that if you give it some OTHER number, it can give you the answer as well.
@jerrydtm I mean, anyone could write a program that just returned the pre-computed answer for 5 or 6 numbers. But that's not programming. The point is to have the computer solve the problem for you. Or rather, write code that solves the problem for a variety of arbitrary inputs.
Jeremiah
@jerrydtm
Sep 20 2015 07:31
okay so the beginning of my issue is the loop...right? thats the most basic thing i dont get about it?
Rex Schrader
@SaintPeter
Sep 20 2015 07:33
@jerrydtm That's where you'll start. You'll need to loop through the numbers from 1 to N (where N is the value passed in to the function) and multiply the numbers together. You'll need a variable to store the product. Then you'll need to return that product.
Jeremiah
@jerrydtm
Sep 20 2015 07:36
okay bear with me
ex=7
so ill write the loop to go from 1 to 7 then multiply all them together then store it in the variable to be returned?
but i wont be writing the numbers just telling it to go from 1 to whatever input it recieves?
Rex Schrader
@SaintPeter
Sep 20 2015 07:37
@jerrydtm Think about this:
factorialize(7);  // This is a function call, passing in a 7
@jerrydtm You're writing the function factorialize
Jeremiah
@jerrydtm
Sep 20 2015 07:38
right
Rex Schrader
@SaintPeter
Sep 20 2015 07:38
@jerrydtm Nowhere in that function will you ever "write" (or type) the number 7
@jerrydtm The number 7 is a parameter that is "passed" into the function
Jeremiah
@jerrydtm
Sep 20 2015 07:38
okay
Rex Schrader
@SaintPeter
Sep 20 2015 07:39
@jerrydtm So the function definiton looks like this:
function factorialize(num) {
// The magic happens here
  return num;  // This doesn't have to be `num` - it can be wherever you store your results
}
@jerrydtm From the perspective of the function, num is 7 .. . unless it's something else. num can be any integer, presumably
@jerrydtm So, if all you know is that your ending condition is num.
@jerrydtm So now you need to write a loop (or something) that counts from 1 to num. For each itteration of the loop you'll need to perform some sort of mathematical operation with the current value of the loop's itterator/counter.
Jeremiah
@jerrydtm
Sep 20 2015 07:41
okay i think i get it. ill go see what i can conjure up
Rex Schrader
@SaintPeter
Sep 20 2015 07:42

@jerrydtm A for loop looks like this:

for(/* initial condition*/ ; /* loop while true */; /*Incrementor */)

the most basic possible loop would be:

for(var i = 0; i < num; i++)

Which would loop from 0 to num - 1

@jerrydtm okie doke
good luck
Jeremiah
@jerrydtm
Sep 20 2015 07:43
thanks @SaintPeter for all the info and help
CamperBot
@camperbot
Sep 20 2015 07:43
jerrydtm sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 663 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 20 2015 07:43
@jerrydtm Sure thing
Jeremiah
@jerrydtm
Sep 20 2015 07:45
on the loop why is it i++...like why the double +
i get thats how much it increases but why double+
Rex Schrader
@SaintPeter
Sep 20 2015 07:45
@jerrydtm i++ is a shortcut for i = i + 1 or i += 1
@jerrydtm there is also an i-- operator which is i = i - 1 or i -= 1
Jeremiah
@jerrydtm
Sep 20 2015 07:46
ohhh okay cool
Soumya Rauth
@soumyaRauth
Sep 20 2015 07:56
I have lost interest in solving ziplines... What should I do?
Jeremiah
@jerrydtm
Sep 20 2015 07:57
@SaintPeter i think i got it
for (var i = num - 1; i >= 1; i--)
num *= i;
return num;
Rex Schrader
@SaintPeter
Sep 20 2015 07:57
@soumyaRauth Try the "You Can Do this" channel
Jeremiah
@jerrydtm
Sep 20 2015 07:57
for (var i = num - 1; i >= 1; i--) 
    num *= i;
    return num;
Rex Schrader
@SaintPeter
Sep 20 2015 07:57
@jerrydtm That looks pretty close. Does it work?
Jeremiah
@jerrydtm
Sep 20 2015 07:58
no
Soumya Rauth
@soumyaRauth
Sep 20 2015 07:58
@SaintPeter whats that?
Rex Schrader
@SaintPeter
Sep 20 2015 07:58
@soumyaRauth https://gitter.im/FreeCodeCamp/YouCanDoThis Motivation for the unmotivated. Consolation for the consolable.
Jeremiah
@jerrydtm
Sep 20 2015 07:59
and then i realized i missed where it wanted me to make sure to make it stop at 0 since it equals 1...so i put in the "if" statement but still didnt work
for (var i = num - 1; i >= 1; i--) 
    num *= i;
    return num;
  if ( i = 0)
    return 1;
nevermind i fixed it
Rex Schrader
@SaintPeter
Sep 20 2015 08:05
@jerrydtm You should put the if statement first and check the value of num
Jeremiah
@jerrydtm
Sep 20 2015 08:05
yep it worked
Yash Paliwal
@ypaliwal
Sep 20 2015 08:05

I'm Struggling this this waypoint:
http://freecodecamp.com/challenges/waypoint-construct-javascript-objects-with-functions

HERE's THE SOLUTION I TRIED ...(Not working):
// Only change code below this line.
var MotorBike = function() {
"wheels",
"engines",
"seats"
};
var myMotorBike = new MotorBike();
myMotorBike.wheels = 2;
myMotorBike.engines = 1;
myMotorBike.seats = 2

// Only change code above this line.

This message was deleted
Jeremiah
@jerrydtm
Sep 20 2015 08:11
so above where it says "only change code below this line" it gives you a basic format to write. so somewhat copy above it but change things to suit what your needing to do
var Car = function() {
  this.wheels = 4;
  this.engines = 1;
  this.seats = 1;
};

var myCar = new Car();
follow that format but change it to suit what you're needing
Yash Paliwal
@ypaliwal
Sep 20 2015 08:31
Ah, figured it out :)
Thanks !
CamperBot
@camperbot
Sep 20 2015 08:31
if you want to thank someone, put an @ before their name!
Yash Paliwal
@ypaliwal
Sep 20 2015 08:31
Thanks @jerrydtm
CamperBot
@camperbot
Sep 20 2015 08:31
ypaliwal sends brownie points to @jerrydtm :sparkles: :thumbsup: :sparkles:
:star: 177 | @jerrydtm | http://www.freecodecamp.com/jerrydtm
karenchungg
@karenchungg
Sep 20 2015 08:36

Hi I'm stuck with kind of an easy problem. http://www.freecodecamp.com/challenges/waypoint-change-the-font-size-of-an-element
Here's what I did:

<style>
.red-text {
color: red;
}
p {
font-size: 16px;
}
</style>

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

<p>kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

<p>kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

I've successfully got the font bigger, but I still can't "Give your p elements the font-size of 16px." when I run tests.

Jeremiah
@jerrydtm
Sep 20 2015 08:37
you're welcome @ypaliwal
what is it your stuck with @karenchungg
karenchungg
@karenchungg
Sep 20 2015 08:39
Hi @jerrydtm I've edited the problem.
Jeremiah
@jerrydtm
Sep 20 2015 08:41
okay one sec
<style>
.red-text {
color: red;
}
p {
font-size: 16px;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<p>kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
so thats how your code looks?
karenchungg
@karenchungg
Sep 20 2015 08:42
yes
I don't know how to make my code paste like yours. :P
Jeremiah
@jerrydtm
Sep 20 2015 08:44
okay so maybe the p { font-size: 16px; } needs to be outside of making the text red
DTing
@dting
Sep 20 2015 08:45
@karenchungg your p elements should also have the red-text class
Jeremiah
@jerrydtm
Sep 20 2015 08:45
that too lol
DTing
@dting
Sep 20 2015 08:45
oh actually
nm it isnt required for this one
your code works for me
maybe refresh your browser
galacticfan
@galacticfan
Sep 20 2015 08:47
Hey, has anybody completed the pairwise bonfire, would love some help?
karenchungg
@karenchungg
Sep 20 2015 08:48
still can't work here :( The preview windows show the font did change, but don't know why I can't submit and go to the next step.
Jeremiah
@jerrydtm
Sep 20 2015 08:48
same here @dting except for needing two <p> elements
karenchungg
@karenchungg
Sep 20 2015 08:48
@jerrydtm what do you mean about "outside of making the text red"? does it mean I should create outside of the <style>?
Jeremiah
@jerrydtm
Sep 20 2015 08:50
no i thought it it looked like you had it mixed in with your .red-text
@galacticfan not sure which one that is
karenchungg
@karenchungg
Sep 20 2015 08:51
oh but how can I separate them? by ";"?
galacticfan
@galacticfan
Sep 20 2015 08:51
bonfire pairwise
CamperBot
@camperbot
Sep 20 2015 08:51

:fire:Bonfire: Pairwise :link:

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

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

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

more info:  bf details | bf links | hint

Jeremiah
@jerrydtm
Sep 20 2015 08:51
i just finished checking for palindrones
galacticfan
@galacticfan
Sep 20 2015 08:51
ahhh
Jeremiah
@jerrydtm
Sep 20 2015 08:52
no your code is fine. it works for me after adding another <p> element
DTing
@dting
Sep 20 2015 08:52
@karenchungg if your code looks like you pasted. It is correct:
<style>
.red-text {
color: red;
}
p {
font-size: 16px;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<p>kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<p>kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
galacticfan
@galacticfan
Sep 20 2015 08:52
The code also works on js fiddle https://jsfiddle.net/6Ln4d9qe/
Jeremiah
@jerrydtm
Sep 20 2015 08:53
ps i forgot to copy the last of the text so i had to add another <p> lol
DTing
@dting
Sep 20 2015 08:53
if it isnt working i'd refresh the page or try a different browser
Jeremiah
@jerrydtm
Sep 20 2015 08:53
your code is fine though. you have it typed out right...something is going on that we cant see though. can you post a screenshot?
Florian Peninon
@florianpnn
Sep 20 2015 08:54
Someone already experienced some weird algebra in JS?
https://jsbin.com/lunote/edit?js,console
1.01 + 2.05 = 3.0599999999999996 :worried:
karenchungg
@karenchungg
Sep 20 2015 08:55
螢幕快照 2015-09-20 下午4.34.09.png
Jeremiah
@jerrydtm
Sep 20 2015 08:56
dude...you have a capital p instead of lowercase
how is that working for us still? lol okay inside your <style> change the p to a lowercase
galacticfan
@galacticfan
Sep 20 2015 08:57
@florianpnn let me take a look
DTing
@dting
Sep 20 2015 08:57
@florianpnn thats due to floating point inaccuracy http://stackoverflow.com/questions/2100490/floating-point-inaccuracy-examples
galacticfan
@galacticfan
Sep 20 2015 08:57
^ +1
karenchungg
@karenchungg
Sep 20 2015 08:58
I think my p is a lowercase?
Jeremiah
@jerrydtm
Sep 20 2015 08:58
oh it looks uppercase
dang...hmmm
karenchungg
@karenchungg
Sep 20 2015 08:59
haha I tried and it's really a lowercase... so weird
DTing
@dting
Sep 20 2015 08:59
capitialization wouldnt matter there works both ways
i would try a different browser
Jeremiah
@jerrydtm
Sep 20 2015 09:01
This message was deleted
<style>
.red-text {
color: red;
}
p {
font-size: 16px;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<p>kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<p>kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
karenchungg
@karenchungg
Sep 20 2015 09:02
god it works in Chrome!
Jeremiah
@jerrydtm
Sep 20 2015 09:02
what browser was you using?
DTing
@dting
Sep 20 2015 09:02
what browser were you using?
Jeremiah
@jerrydtm
Sep 20 2015 09:02
lol
Florian Peninon
@florianpnn
Sep 20 2015 09:02
@dting @galacticfan How can I solve it in JS?
karenchungg
@karenchungg
Sep 20 2015 09:02
firefox
Jeremiah
@jerrydtm
Sep 20 2015 09:03
weird
DTing
@dting
Sep 20 2015 09:08
@florianpnn if you are dealing with money you can deal with cents rather than dollars to get rid of the decimal. Or you can use toFixed([digits]) which converts the number to a rounded decimal and returns a string
Florian Peninon
@florianpnn
Sep 20 2015 09:08
@dting I will go for the cents part! It will be easier but will have a look at toFixed. Thanks!
CamperBot
@camperbot
Sep 20 2015 09:08
florianpnn sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1216 | @dting | http://www.freecodecamp.com/dting
karenchungg
@karenchungg
Sep 20 2015 09:09
thanks anyway!
CamperBot
@camperbot
Sep 20 2015 09:09
if you want to thank someone, put an @ before their name!
DTing
@dting
Sep 20 2015 09:10
nps
karenchungg
@karenchungg
Sep 20 2015 09:10
@jerrydtm and @dting thanks~!
CamperBot
@camperbot
Sep 20 2015 09:10
karenchungg sends brownie points to @jerrydtm and @dting :sparkles: :thumbsup: :sparkles:
:star: 179 | @jerrydtm | http://www.freecodecamp.com/jerrydtm
:star: 1217 | @dting | http://www.freecodecamp.com/dting
Elizabeth Hatleli
@TheHighPriestess
Sep 20 2015 09:19

I'm confused about something. I was talking about it here last night...but the question remains unanswered:

When you take a number - binary, decimal...any number....and convert it to a string using .toString() and storing it in a variable...

.parseInt does NOT work on it.

Am I correct?

Elizabeth Hatleli
@TheHighPriestess
Sep 20 2015 09:39
I ended up doing it this way:
var str = "01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111";

var res = str.split(" "); ///creates an array

console.log(res[0]);

typeof res[0];

var digit = parseInt(res[0], 2);
console.log(digit);
Why parseInt works for res[0] and not for a variable name is the great mystery for me
Risle
@Risle
Sep 20 2015 09:50
@TheHighPriestess I just tried what you described and it works for me: Here's the repl.it: https://repl.it/BJ0j
mwandama
@mwandama
Sep 20 2015 09:54
how do i Add a div element with the class well inside each of your div elements with the class
question 86
Karolis
@Luomint
Sep 20 2015 10:10
bonfire slasher flick
CamperBot
@camperbot
Sep 20 2015 10:10

:fire:Bonfire: Slasher Flick :link:

function slasher(arr, howMany) {
  // it doesn't always pay to be first
  return arr;
}

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

Return the remaining elements of an array after chopping off n elements from the head.

more info:  bf details | bf links | hint

Karolis
@Luomint
Sep 20 2015 10:10
bf details
CamperBot
@camperbot
Sep 20 2015 10:10

:fire:Bonfire: Slasher Flick :link:

function slasher(arr, howMany) {
  // it doesn't always pay to be first
  return arr;
}

slasher([1, 2, 3], 2);
Return the remaining elements of an array after chopping off n elements from the head.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
Karolis
@Luomint
Sep 20 2015 10:11
First test is: [1, 2, 3], 2 so remove 2 last items of this array and return the remainder... and the answer expected is 3?
shouldn't it be 1?
mwandama
@mwandama
Sep 20 2015 10:34

i was asked to Create a CSS class called pink-text that gives an element the color pink.

Give your h1 element the class of pink-text. This is my solution <h1 class="pink-text><h1> The following is the code for my css .pink-text{ color:pink !important}

Avishay
@avishayshushan
Sep 20 2015 10:37
@mwandama after !importanat u need ';'
Avishay
@avishayshushan
Sep 20 2015 11:22
hey all
my bonfire is stack due to infinite loop and i cant change the script
it's always run the code even when i restart chrome browser
Comfort
@freecodecomfort
Sep 20 2015 11:34
hello! I keep getting an erorr when trying to "npm publish". as anyone experienced that ?
Karolis
@Luomint
Sep 20 2015 11:58
bonfire Slasher flick
CamperBot
@camperbot
Sep 20 2015 11:58

:fire:Bonfire: Slasher Flick :link:

function slasher(arr, howMany) {
  // it doesn't always pay to be first
  return arr;
}

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

Return the remaining elements of an array after chopping off n elements from the head.

more info:  bf details | bf links | hint

Sam
@Samparkyn
Sep 20 2015 11:59
hi guys.. im kinda stuck with how to factorialize a number.. any help would be much appreciated! thaaanks :)
Karolis
@Luomint
Sep 20 2015 12:00
bf links
CamperBot
@camperbot
Sep 20 2015 12:00
Karolis
@Luomint
Sep 20 2015 12:00
hint
CamperBot
@camperbot
Sep 20 2015 12:00
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Karolis
@Luomint
Sep 20 2015 12:01
you can check the hint page as well
Basically, you need a loop to deduce each number by 1 and than multiply it
3! = 3 (3-1) (3-2) = 6
Deepanshu Kaushik
@daksh844
Sep 20 2015 12:03
any hint or advice is welcome
blob
Karolis
@Luomint
Sep 20 2015 12:08
@daksh844 you need .this to make get speed public
in more than one place
Deepanshu Kaushik
@daksh844
Sep 20 2015 12:10
@Luomint sorry not working
also can I'm not able to understand that how do we make a new object as private
Karolis
@Luomint
Sep 20 2015 12:11
@daksh844 try finding 2 places to put this. when get speed is defined
basically anything without this. is private, to make it public you add .this
to make it private you remove .this or don't type it in the first place
before a variable
Deepanshu Kaushik
@daksh844
Sep 20 2015 12:12
blob
Karolis
@Luomint
Sep 20 2015 12:13
remove those two this.getSpeed; you addeed
you need to use what you already have to add .this to ^^
@daksh844 if you give up, you will see it was easy though http://puu.sh/khNcQ/e7e91e0695.png
I dont fully understand it yet too, I just tried putting .this in various places and experimenting
Deepanshu Kaushik
@daksh844
Sep 20 2015 12:17
but I'm not able to increase my knowledge
as dont have answer why is this happening, and why are we putting it
Karolis
@Luomint
Sep 20 2015 12:18
basically if a variable like speed = 100 is inside a function, it's only accessible for the program inside the function, if you want to access speed outside the function, you need to make it this.speed = 100;
Deepanshu Kaushik
@daksh844
Sep 20 2015 12:21
like you added this. before getSpeed would this make the addUnit object also public
as we were require to make getSpeed and addunit public
Karolis
@Luomint
Sep 20 2015 12:21
I just tried that, and it says that it's not a function
though it its, even if it worked, the speed inside it would still be private
Deepanshu Kaushik
@daksh844
Sep 20 2015 12:23
yea, you're right - but I'm confused about the addUnit
how did that become public
Karolis
@Luomint
Sep 20 2015 12:25
it was public, when the it was this.speed
once you remove it, it's private because all the variables in it are
and add unit just served to add km/h at the end of speed
'value' is just a temporary value
Ngaosathe
@ThekhoN
Sep 20 2015 12:25
Can any one help me with robocopy purge?? trying to delete a long-named file in windows..
Deepanshu Kaushik
@daksh844
Sep 20 2015 12:26
got it thanks @Luomint
CamperBot
@camperbot
Sep 20 2015 12:26
daksh844 sends brownie points to @luomint :sparkles: :thumbsup: :sparkles:
:star: 182 | @luomint | http://www.freecodecamp.com/luomint
Karolis
@Luomint
Sep 20 2015 12:26
:)
azaleas
@azaleas
Sep 20 2015 12:27
Can any1 help with Weather app zipline? how to get a data for the weather?
Elizabeth Hatleli
@TheHighPriestess
Sep 20 2015 12:28
@Risle hmmm...OK.
well....i was converting to a string using .toString...and couldn't get it to work
anyway...i did finally complete the Bonfire (Binary Agents) using a different technique
Aaron Davis
@danger1300
Sep 20 2015 12:31
I am doing one of the bonfire challenges and I have only 1 that does not pass. I need to debug and see why it is not working. Can anyone recommend how to output the value(s) of variables in javascript?
Coira Ellison
@Coira
Sep 20 2015 12:32
Elizabeth Hatleli
@TheHighPriestess
Sep 20 2015 12:32
@danger1300 if you want to see what's stored in them...use console.log(variable name);
Coira Ellison
@Coira
Sep 20 2015 12:33
i.e use console.log(varName) and use the web console (press f12 in chrome/ffox in windows)
Aaron Davis
@danger1300
Sep 20 2015 12:34
ahhhh. that makes sense. Wish we had that waypoint before we started doing some of the earlier bonfires. ;) Thank you @TheHighPriestess @Coira
CamperBot
@camperbot
Sep 20 2015 12:34
danger1300 sends brownie points to @thehighpriestess and @coira :sparkles: :thumbsup: :sparkles:
:star: 224 | @coira | http://www.freecodecamp.com/coira
:star: 260 | @thehighpriestess | http://www.freecodecamp.com/thehighpriestess
Coira Ellison
@Coira
Sep 20 2015 12:34
yeah it would be helpful if it was introduced earlier
Elizabeth Hatleli
@TheHighPriestess
Sep 20 2015 12:38
@danger1300 console.log is extremely useful. I use it all the time.
Prabhu
@itsprabhucbe
Sep 20 2015 12:40
Hello friends how to Manipulate Arrays With pop() in javascript..
Elizabeth Hatleli
@TheHighPriestess
Sep 20 2015 12:41
@itsprabhucbe pop removes the last element in the array
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop();

//removes "Mango"
result will be Banana,Orange,Apple
Prabhu
@itsprabhucbe
Sep 20 2015 12:43
Thanks @TheHighPriestess ..
CamperBot
@camperbot
Sep 20 2015 12:43
itsprabhucbe sends brownie points to @thehighpriestess :sparkles: :thumbsup: :sparkles:
:star: 261 | @thehighpriestess | http://www.freecodecamp.com/thehighpriestess
Prabhu
@itsprabhucbe
Sep 20 2015 12:43
@TheHighPriestess ..great
tommyosh
@tommyosh
Sep 20 2015 12:49
I am having trouble understanding what this means Math.floor(Math.random() * (max - min + 1)) + min
FreeCodeCamperBob
@FreeCodeCamperBob
Sep 20 2015 12:52
Hello Everyone! I would be very gratefull if someone helped me with 122 excercise. I'm having trouble with this code:
var firstNameLength = 3;
var lastNameLength = 8;
var firstName = "Bob";
firstNameLength = firstName.length;
var lastName = "Mckenzie";
lastNameLength = 8;
if(typeof(lastNameLength) !== "undefined"){(function(){return lastNameLength;})();}
my code doesn't work (((
Coira Ellison
@Coira
Sep 20 2015 12:53
@tommyosh say you want to generate a random number between the values 2 and 10, you would use
var random = Math.floor(Math.random() * (10 - 2 + 1)) + 2)
rbunz
@rbunz08
Sep 20 2015 12:53
@tommyosh can you show me your whole code?
Aaron Davis
@danger1300
Sep 20 2015 12:54
@tommyosh Math.random() returns a decimal and Math.floor() helps you gives it a minimum value when you multiply it by Math.random()
rbunz
@rbunz08
Sep 20 2015 12:54
@FreeCodeCamperBob you have lastNameLength twice?
tommyosh
@tommyosh
Sep 20 2015 12:55
Thanks guys, I think I get it. It is part of Waypoint: Generate Random Whole Numbers within a Range
CamperBot
@camperbot
Sep 20 2015 12:55
if you want to thank someone, put an @ before their name!
FreeCodeCamperBob
@FreeCodeCamperBob
Sep 20 2015 12:55
@rbunz08 no
Omar
@oab00
Sep 20 2015 12:56
@FreeCodeCamperBob can u link to the exercise
rbunz
@rbunz08
Sep 20 2015 12:57
@FreeCodeCamperBob You have varLastNameLength = 8 twice... try putting lastNameLength = lastName.length;
Omar
@oab00
Sep 20 2015 12:58
@rbunz08 is right
rbunz
@rbunz08
Sep 20 2015 12:58
@FreeCodeCamperBob the only thing you need to do to the code is add .length at the end of the lastName part
FreeCodeCamperBob
@FreeCodeCamperBob
Sep 20 2015 12:59
@rbunz08 ok
Prabhu
@itsprabhucbe
Sep 20 2015 12:59
@rbunz08 the code is working
FreeCodeCamperBob
@FreeCodeCamperBob
Sep 20 2015 13:04
@rbunz08 Can you send me the full code please?! I'm novice coz I couldn't do what you wrote (((
Omar
@oab00
Sep 20 2015 13:08
@FreeCodeCamperBob click the reset button on the left
tommyosh
@tommyosh
Sep 20 2015 13:09
you add .length to lastNameLength . Nothing else :)
FreeCodeCamperBob
@FreeCodeCamperBob
Sep 20 2015 13:10
:smile: :smile: :smile:
@oab00 It's working!))
@tommyosh :smile: :smile: :smile:
tommyosh
@tommyosh
Sep 20 2015 13:12
It confused me first time around. I thougt there would be more to it!
FreeCodeCamperBob
@FreeCodeCamperBob
Sep 20 2015 13:12
@rbunz08 @oab00 @itsprabhucbe @tommyosh Thanks guys! I'm sorry for disturbing with a little problem :smile: :clap:
CamperBot
@camperbot
Sep 20 2015 13:12
freecodecamperbob sends brownie points to @rbunz08 and @oab00 and @itsprabhucbe and @tommyosh :sparkles: :thumbsup: :sparkles:
:star: 171 | @itsprabhucbe | http://www.freecodecamp.com/itsprabhucbe
:star: 285 | @oab00 | http://www.freecodecamp.com/oab00
:star: 233 | @rbunz08 | http://www.freecodecamp.com/rbunz08
:star: 162 | @tommyosh | http://www.freecodecamp.com/tommyosh
FreeCodeCamperBob
@FreeCodeCamperBob
Sep 20 2015 13:13
@tommyosh I thought so ))
@oab00 @rbunz08 :+1:
Lasha Takashvili
@Higgsx
Sep 20 2015 13:33
Bonfire: Make a person
I've some problems with this bonfire
It doesn't work well. Can anyone help me with this?
code:
var Person = function(firstAndLast) {
    this.getFirstName = function(){
      return firstAndLast.split(" ")[0];
    }
    this.getLastName = function(){
        return firstAndLast.split(" ")[1];
    }
    this.getFullName = function(){
        return firstAndLast;
    }
    this.setFirstName = function(first){
        this.firstname = first;
    }
    this.setLastName = function(last){
        this.lastname = last;
    }
    this.setFullName = function(firstAndLast){
        this.fullname = firstAndLast;
    }
};

var bob = new Person('Bob Ross');
bob.getFullName();
CamperBot
@camperbot
Sep 20 2015 13:33
Sorry, can't find a bonfire called make a personive some problems with this bonfireit doesnt work well can anyone help me with thiscodevar person functionfirstandlast thisgetfirstname function return firstandlastsplit 0 thisgetlastname function return firstandlastsplit 1 thisgetfullname function return firstandlast thissetfirstname functionfirst thisfirstname first thissetlastname functionlast thislastname last thissetfullname functionfirstandlast thisfullname firstandlast var bob new personbob rossbobgetfullname. [ Check the map? ]
Ngaosathe
@ThekhoN
Sep 20 2015 13:41
can someone help me with the bouncer bonfire bouncer..pleasu
CamperBot
@camperbot
Sep 20 2015 13:41
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Tom Lorimer
@Ellf
Sep 20 2015 14:14
bonfire Seek and Destroy
CamperBot
@camperbot
Sep 20 2015 14:14

:fire:Bonfire: Seek and Destroy :link:

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

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

You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.

more info:  bf details | bf links | hint

Tom Lorimer
@Ellf
Sep 20 2015 14:14
bf hint
CamperBot
@camperbot
Sep 20 2015 14:14
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Prabhu
@itsprabhucbe
Sep 20 2015 14:32
Hi anyone help me Use Conditional Logic with If and Else Statements link is http://freecodecamp.com/challenges/waypoint-use-conditional-logic-with-if-and-else-statements
Prabhu
@itsprabhucbe
Sep 20 2015 14:40
This message was deleted
CamperBot
@camperbot
Sep 20 2015 14:40
no wiki entry for: me use conditional logic with if and else statements code
:pencil: click here to create one now!after creating your page type update to reload it here
Prabhu
@itsprabhucbe
Sep 20 2015 14:42
Sorry i m not understand @camperbot
This message was deleted
Pete McPherson
@StartupDino
Sep 20 2015 14:50
Bonfire: Falsy Bouncer
CamperBot
@camperbot
Sep 20 2015 14:50
Sorry, can't find a bonfire called falsy bouncer. [ Check the map? ]
Juan Riquelme
@soulchainer
Sep 20 2015 14:50
wp use conditional logic
ummm xD.
Juan Riquelme
@soulchainer
Sep 20 2015 14:56
wiki Use Conditional Logic with If-Else Statements
CamperBot
@camperbot
Sep 20 2015 14:56

:point_right: waypoint use conditional logic with if else statements [wiki]

Use Conditional Logic with If-Else Statements

We can use if statements in JavaScript to only execute code if a certain condition is met.

if statements require some sort of boolean condition evaluate.

Example:

 if (1 == 2) {
  return(true);
}
else {
  return(false);
}

:pencil: read more about waypoint use conditional logic with if else statements on the FCC Wiki

Juan Riquelme
@soulchainer
Sep 20 2015 14:56
That's it, @itsprabhucbe xD
What's the prob?
Tesseract
@firecodergithub
Sep 20 2015 15:05
hi guys! doing the zipline on twitch API and I have one question: Since getting the streaming status and the profile picture can only be done in separata JSON API calls (asynchronous), that means I'm supposed to ensure that for each username the corresponding call for streaming status is completed before getting the profile picture callback? I don't know if this question makes sense, but I have some profile pics not getting created sometimes because the other API call (for streaming status) is not yet completed
Juan Riquelme
@soulchainer
Sep 20 2015 15:07
Yeah, @firecodergithub
And yes, I get the same problem, I guess. But... it happens even when I'm sure I get the data xD (and, in fact, I get it xD).
Or I don't know, maybe I should recheck the code xD. But the image it's the only thing that fails.
Tesseract
@firecodergithub
Sep 20 2015 15:09
well, seems like a bit of overkill, but I guess I have to find the best way to communicate status between both of the callbacks and introduce some waiting times
Juan Riquelme
@soulchainer
Sep 20 2015 15:12
I mean, I get other data in the same call, you know. And every other data gets recover: you know, that's only a json request, so text. So, if I get the rest of the data in that json request... it should also recover the url of the avatar (that's the important thing, not the image). So, I don't know. Maybe the url sometimes is not recover, for some reason >_<.
Renemari Padillo
@renesansz
Sep 20 2015 15:18
Hey everyone, some of my progress were lost did any of you experience this? (eg: Basic JavaScript has been reset to 0) T_T
Hans van Riet
@hansinla
Sep 20 2015 15:21
@firecodergithub Nest the second call inside the first call, that way you ensure that the data is available.
Comfort
@freecodecomfort
Sep 20 2015 15:24
Hello! PROBLEM: WAYPOINT MANAGE PACKAGES WITH NPM---- I keep getting error at the add dist-tafg stage..hs anyone been through that?
Sean Campbell
@natac13
Sep 20 2015 15:31
help make a person
CamperBot
@camperbot
Sep 20 2015 15:31

:point_right: bonfire make a person [wiki]

Explanation:

When I started the program I figured I just had to create the six functions mentioned in the details. However, it was not as simple. Creating them as a function was not the right way, I had to create them in a different way to make them a key.

There is also a tricky part as you need six keys no more or less, so at first I had the variable that store the original name as a key too which was wrong.

As for the usage of array, that is optional, you could also create new variable to hold the separated string if you wish but an array is easier to deal with as strings are immutable.

Read the instructions carefully, it is always a good hint on itself to run the code and check what the test results were so you know what to expect but do not fixate yourself on that. Once you understand what you need to do, this problem is very easy and straightforward.

:pencil: read more about bonfire make a person on the FCC Wiki

Paul Simon Ongpin
@mochiii
Sep 20 2015 15:36
can somebody help me with the forismatic api for random quote generator I cant output the quote and author http://codepen.io/mochiii/pen/YyqmJP?editors=101
Sean Campbell
@natac13
Sep 20 2015 15:38
@mochiii you are not able to put the response.quotewhatever inside that html() try string concatenation
like
"<p>" + response.quote + "</p>"
Tesseract
@firecodergithub
Sep 20 2015 15:39
@hansinla thanks for the pointer, seems the most straightforward trick actually, I was thinking of overcomplicated solutions
CamperBot
@camperbot
Sep 20 2015 15:39
firecodergithub sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 385 | @hansinla | http://www.freecodecamp.com/hansinla
Paul Simon Ongpin
@mochiii
Sep 20 2015 15:39
@natac13 ok sir i'll try thanks
CamperBot
@camperbot
Sep 20 2015 15:39
mochiii sends brownie points to @natac13 :sparkles: :thumbsup: :sparkles:
:star: 344 | @natac13 | http://www.freecodecamp.com/natac13
Sean Campbell
@natac13
Sep 20 2015 15:40
@mochiii well there is more
lol
Paul Simon Ongpin
@mochiii
Sep 20 2015 15:42
@natac13 i tried $(".quote").html("<p>" + response.quoteText + "</p>");
still cant get the output
Sean Campbell
@natac13
Sep 20 2015 15:43
yeah I am looking now lol sorry
Paul Simon Ongpin
@mochiii
Sep 20 2015 15:45
@natac13 i think the problem is in the getJson url this is the API http://forismatic.com/en/api/ i just cant figure it out lol
Prabhu
@itsprabhucbe
Sep 20 2015 15:48

hi @soulchainer @camperbot condition for program is

"Create if and else statements to return the string "heads" if the flip variable is zero, or else return the string "tails" if the flip variable is not zero".

Paul Simon Ongpin
@mochiii
Sep 20 2015 15:49
@natac13 got it working just adjusted the url thanks for the help awesome
CamperBot
@camperbot
Sep 20 2015 15:49
mochiii sends brownie points to @natac13 :sparkles: :thumbsup: :sparkles:
:warning: mochiii already gave natac13 points
ThankGod Richard
@thankgodr
Sep 20 2015 15:49
function where(arr, num) {

  arr.sort(function(a, b) {
  return a - b;
  });

  var checkbe = 0;

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

    if(arr[i] < num){
      checkbe = i + 1;
    } 
      else{
      return checkbe;
    }
  }
}
please i wrote this code but when i submit it i still got one error on assert(where([2, 5, 10], 15) === 3, '[2, 5, 10], 15 should return 3.');
please how can i fix this
Sean Campbell
@natac13
Sep 20 2015 15:50
@mochiii can I ask what the change in the url was
tva10
@tva10
Sep 20 2015 15:52
@thankgodr look on your If Else statement
@thankgodr you need to return checkbe
@thankgodr but in these steatement it doesnot work
@thankgodr if you put return after loop it will be work
ThankGod Richard
@thankgodr
Sep 20 2015 15:56
@tva10 thanks for the help. It worked
CamperBot
@camperbot
Sep 20 2015 15:56
if you want to thank someone, put an @ before their name!
Prabhu
@itsprabhucbe
Sep 20 2015 16:00
Comfort
@freecodecomfort
Sep 20 2015 16:06
PROBLEM: WAYPOINT PACKAGESS NPM: I keep getting the error "Uh oh, looks like you still only have a single dist-tag.
Use npm help dist-tag to learn how to add another one." even after I have add tags..what could be the problem
Paul Simon Ongpin
@mochiii
Sep 20 2015 16:11
please help me with the button behavior it does not go back to default after i click it. can somebody help me out thanks http://codepen.io/mochiii/pen/YyqmJP
CamperBot
@camperbot
Sep 20 2015 16:11
if you want to thank someone, put an @ before their name!
Rex Schrader
@SaintPeter
Sep 20 2015 16:14
@mochiii Taking a look
Juan Riquelme
@soulchainer
Sep 20 2015 16:14
Well, the text said everything, @itsprabhucbe . Use and if/else and return the string head when you are told you should return it and return tails when you are also told you should return it. If we say more, we should make the exercise for you. Is so close to natural language...
Rex Schrader
@SaintPeter
Sep 20 2015 16:15
@mochiii It seems to be working to me. I click the button and get a quote. What were you expecting?
Paul Simon Ongpin
@mochiii
Sep 20 2015 16:16
@SaintPeter the button animation sir. it does not pop out after i click the button lol
Prabhu
@itsprabhucbe
Sep 20 2015 16:18
k.. @soulchainer i understand the concept..that code is not working for me..
Paul Simon Ongpin
@mochiii
Sep 20 2015 16:19
@SaintPeter i think its fine haha thanks for looking at it btw awesome! sorry for the interuption
CamperBot
@camperbot
Sep 20 2015 16:19
mochiii sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 664 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Sep 20 2015 16:20
@mochiii There are several pseudo-elements for buttons: :hover, :click, and :active - the problem is that Bootstrap sets the same values for :active (IE: the button has focus) as for :click. You're going to need to override :active, I think.
@mochiii It may be :focus, not :active
Juan Riquelme
@soulchainer
Sep 20 2015 16:21
@itsprabhucbe Show how you understand the concept in form of quoted code here and we will see what problem you have.
Paul Simon Ongpin
@mochiii
Sep 20 2015 16:21
its the focus i tried it and messed up the css so i revert it back @SaintPeter
Rex Schrader
@SaintPeter
Sep 20 2015 16:23

@mochiii This should fix it:

.btn-danger.focus, .btn-danger:focus {
    color: #fff;
    background-color:  #d9534f;
    border-color: #d43f3a;
}

I copied the values from .btn-danger

Prabhu
@itsprabhucbe
Sep 20 2015 16:26
@soulchainer this my code if (0==1){
return heads;
} else {
return tails;
}
Paul Simon Ongpin
@mochiii
Sep 20 2015 16:26
@SaintPeter awesome!!!!! thanks i adjusted it a bit thank you very much sir!
CamperBot
@camperbot
Sep 20 2015 16:26
mochiii sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: mochiii already gave saintpeter points
Juan Riquelme
@soulchainer
Sep 20 2015 16:27

aha... I will paste you again the instructions you get. You see something different?

// Create an if-else statement here to return "heads" if flip is 0. Otherwise return "tails".

And the variable flip you are getting mentioned:

var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;

Because you will need to think. This is for your own good. Think a bit about that and, if you still have problems, ask again later.

Rex Schrader
@SaintPeter
Sep 20 2015 16:27
@mochiii :D I had exactly the same problem on my Basejump app.
Juan Riquelme
@soulchainer
Sep 20 2015 16:28
And check again previously lessons about use of if/else and variables. That will help you.
Prabhu
@itsprabhucbe
Sep 20 2015 16:29
@soulchainer k..
Alin-Lucian Baboi
@AlinLucian
Sep 20 2015 16:45
@mochiii Hi! We haven't spoken, but glancing at your code for the Random Quote Machine helped be get unstuck. In the end it was a silly mistake of mine, but it cost me hours of research. So, thank you! :)
CamperBot
@camperbot
Sep 20 2015 16:45
alinlucian sends brownie points to @mochiii :sparkles: :thumbsup: :sparkles:
:star: 190 | @mochiii | http://www.freecodecamp.com/mochiii
naxty
@naxty
Sep 20 2015 16:59
bonfire: inventory update
CamperBot
@camperbot
Sep 20 2015 16:59

:fire:Bonfire: Inventory Update :link:

function inventory(arr1, arr2) {
    // All inventory must be accounted for or you're fired!
    return arr1;
}

// Example inventory lists
var curInv = [
    [21, 'Bowling Ball'],
    [2, 'Dirty Sock'],
    [1, 'Hair Pin'],
    [5, 'Microphone']
];

var newInv = [
    [2, 'Hair Pin'],
    [3, 'Half-Eaten Apple'],
    [67, 'Bowling Ball'],
    [7, 'Toothpaste']
];

inventory(curInv, newInv);

Compare and update inventory stored in a 2d array against a second 2d array of a fresh delivery. Update current inventory item quantity, and if an item cannot be found, add the new item and quantity into the inventory array in alphabetical order.

more info:  bf details | bf links | hint

naxty
@naxty
Sep 20 2015 16:59
hint
CamperBot
@camperbot
Sep 20 2015 16:59
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Chris
@Shifthawke
Sep 20 2015 17:14
This message was deleted
tommyosh
@tommyosh
Sep 20 2015 18:29
This message was deleted
nvm typo
:/
Jibanprakash
@Jibanprakash
Sep 20 2015 18:35

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

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

<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">

this above code doesn't work
and i can't go beyond thins
Give your image a border width of 10px
but i have already given 10px
HTML/CSS Waypoint: Add Borders Around your Elements : I am stuck here
is there a bug ?
tommyosh
@tommyosh
Sep 20 2015 18:39
is that your full code?
Jibanprakash
@Jibanprakash
Sep 20 2015 18:40

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

h2 {
font-family: Lobster, Monospace;
}

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

.smaller-image {
width: 100px;
}
.thin-red-border { border-color: red; border-width: 5px; border-style: solid; }
.thick-green-border { border-color: green; border-width: 10px; border-style: solid; }
</style>

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

<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat">

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

this is it
tommyosh
@tommyosh
Sep 20 2015 18:40
.thin-red-border { border-color: red; border-width: 5px; border-style: solid; }
shoudlnt be there
Jibanprakash
@Jibanprakash
Sep 20 2015 18:40
but the exercise is to make the width as 10px
tommyosh
@tommyosh
Sep 20 2015 18:40
shouldn't
Jibanprakash
@Jibanprakash
Sep 20 2015 18:40
but nyway i am not using that class
its just there in style
does that matter?
tommyosh
@tommyosh
Sep 20 2015 18:41
get rid of it and it will work
its working for me, all your code, must be your browser
I'm using Chrome
Jibanprakash
@Jibanprakash
Sep 20 2015 18:43
I m using opera
tommyosh
@tommyosh
Sep 20 2015 18:43
Ok, that may be the issue. It is working for me. I copied your code and it worked.
Jibanprakash
@Jibanprakash
Sep 20 2015 18:46
yes i got that
Thanks mate
CamperBot
@camperbot
Sep 20 2015 18:46
if you want to thank someone, put an @ before their name!
Jibanprakash
@Jibanprakash
Sep 20 2015 18:46
i have raised a bug for this case
Thanks @tommyosh
CamperBot
@camperbot
Sep 20 2015 18:46
jibanprakash sends brownie points to @tommyosh :sparkles: :thumbsup: :sparkles:
:star: 167 | @tommyosh | http://www.freecodecamp.com/tommyosh
tommyosh
@tommyosh
Sep 20 2015 18:53
No prob @Jibanprakash
Brian Mayers
@4mifix
Sep 20 2015 19:13
Screen Shot 2015-09-20 at 3.11.00 PM.png
Where did I go wrong ? Everything is passing except the last one
SojournerOctocat
@SojournerOctocat
Sep 20 2015 19:20
@4mifix lengths.sort sorts alphabetically (and results in [ 1, 10, 19, 2, 2, 2, 3, 4, 4, 4 ]). You return the last number from that array. I suggest using Math.max to get the largest number from that array instead.
Brian Mayers
@4mifix
Sep 20 2015 19:24
@SojournerOctocat :+1:
Karolis
@Luomint
Sep 20 2015 19:25
bf mutations
CamperBot
@camperbot
Sep 20 2015 19:25

:fire:Bonfire: Mutations :link:

function mutation(arr) {
  return arr;
}

mutation(['hello', 'hey']);

Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.

more info:  bf details | bf links | hint

Karolis
@Luomint
Sep 20 2015 19:25
hint
CamperBot
@camperbot
Sep 20 2015 19:25
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Alex
@artitudinale1
Sep 20 2015 19:47
Hi guys, need a lil help ...does this makes any sense: var expression = testString/\d+/g; ?
tva10
@tva10
Sep 20 2015 19:51
@artitudinale1 nope, You want to make RegExp?
@artitudinale1 if testString is variable you should write this: var expr = new RegExp (testString+'\d+', 'g')
Alex
@artitudinale1
Sep 20 2015 19:53
yep @tva10 that s what i'm trying to do at Waypoint: Find Numbers with Regular Expressions
tva10
@tva10
Sep 20 2015 19:54
@artitudinale1 oops, I edit prev comment
@artitudinale1 ou, if you want to make this waypoint you need this expr /\d+/gi
MrDrBird
@MrDrBird
Sep 20 2015 19:58
Anyone willing to help me figure out how to make an array of information using $.getJson() responses?
var stream = [];
var streamNames = ["freecodecamp", "storbeck", "terakilobyte", "medrybw", "habathcx", "RobotCaleb", "thomasballinger", "noobs2ninjas", "sololineabuse"];

var getBasicInfo = function(streamName){
  $.getJson('https://api.twitch.tv/kraken/users/' + streamName +'?callback=?', function(response){
    this.name = response.display_name;
    this.pic = response.logo;    
  });
};

for (var i=0; i<streamNames.length; i++){
  stream.push(getBasicInfo(streamNames[i]));
}
this is what I have tried... but the function fails
Alex
@artitudinale1
Sep 20 2015 19:59
@tva10 oh ok......now starts to make sense! thanks!:)
CamperBot
@camperbot
Sep 20 2015 19:59
artitudinale1 sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:star: 235 | @tva10 | http://www.freecodecamp.com/tva10
tva10
@tva10
Sep 20 2015 19:59
@MrDrBird if function fails, write responce into console.log
@MrDrBird but this object (response) like an associative array. You can write this response['logo'] to acces logo
MrDrBird
@MrDrBird
Sep 20 2015 20:03
@tva10 hmmm, I am re-writing my twitch tv app in angular.js and response.logo worked last time just fine...
really just wondering how to make an array (stream=[]) contain the name and picture info of all the names in streamNames
John Oksasoglu
@oksas
Sep 20 2015 20:10
I had a separate question related to the twitch assignment actually. if you use the api call for /streams/channel_name, if the user is offline, you can't get some generic info like their channel logo from the json that is returned. if you do it with /channels/channel_name, though, you can get all that info, but not tell if they're currently streaming or not. so I need to use data from two separate api calls but don't know how to do that in a nice way D:
tva10
@tva10
Sep 20 2015 20:12
@oksas @MrDrBird Emm, does codepen.io cannot acces https?
twitch api use https?
MrDrBird
@MrDrBird
Sep 20 2015 20:13
@oksas I searched the /streams/(user), and made an if() statement... if the response.stream was null I would do a different search for the /channel/(user)
John Oksasoglu
@oksas
Sep 20 2015 20:13
@tva10 I am using https for the twitch api url and it's working for me, at least
@MrDrBird ahhh okay
John Oksasoglu
@oksas
Sep 20 2015 20:14
lemme look at this
MrDrBird
@MrDrBird
Sep 20 2015 20:14
thats what I did the first go through... the sort buttons dont do anything
but, its how i got the minimum requirements for the challenge
John Oksasoglu
@oksas
Sep 20 2015 20:16
ahhh that makes total sense. very nice. @MrDrBird thanks so much :D
CamperBot
@camperbot
Sep 20 2015 20:16
oksas sends brownie points to @mrdrbird :sparkles: :thumbsup: :sparkles:
:star: 233 | @mrdrbird | http://www.freecodecamp.com/mrdrbird
MrDrBird
@MrDrBird
Sep 20 2015 20:17
np
John Oksasoglu
@oksas
Sep 20 2015 20:17
I haven't done the sorting part yet, but when I create the html elements for each stream, if they're offline, I give the div an "offline" class, and "online" if online. I figure then I can use the buttons with jQuery to simply hide and show each channel's div based on whether it has the offline/online class. would that work?
at least for the online/offline part, haven't given too much thought to the search function yet D:
MrDrBird
@MrDrBird
Sep 20 2015 20:18
maybe. didn't work with the way i did my code... which is why im rewriting it lol
John Oksasoglu
@oksas
Sep 20 2015 20:18
hahaha alright
thanks again for your help. such a simple fix for something that had me so confused
CamperBot
@camperbot
Sep 20 2015 20:18
if you want to thank someone, put an @ before their name!
MrDrBird
@MrDrBird
Sep 20 2015 20:18
but, the way i got my information just work for you, just dont add it to the html like i did
*should not just
John Oksasoglu
@oksas
Sep 20 2015 20:19
you mean when you do things like this? $('#' + person).append('<img class="userPic pull-left" src="' + data.logo + '" alt="No Pic"/>');
because that's more or less exactly how I was adding it to html D: what would be a better way?
Hugo
@hugoender
Sep 20 2015 20:20

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

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

h2 {
font-family: Lobster, Monospace;
}

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

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

.smaller-image {
width: 100px;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>
<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat"></a>

<ul>
<li>Click here for <a href="#">cat photos</a>.</li>

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

oops
John Oksasoglu
@oksas
Sep 20 2015 20:21
lol
Hugo
@hugoender
Sep 20 2015 20:21
is there a quick way to paste the program from the waypoint into chat
or do i need to do print screen?
MrDrBird
@MrDrBird
Sep 20 2015 20:21
@oksas I wouldn't recommend it if you can figure out a different way
tva10
@tva10
Sep 20 2015 20:22
help formatting
CamperBot
@camperbot
Sep 20 2015 20:22

: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

Hugo
@hugoender
Sep 20 2015 20:22

'''html

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

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

h2 {
font-family: Lobster, Monospace;
}

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

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

.smaller-image {
width: 100px;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>
<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat"></a>

<ul>
<li>Click here for <a href="#">cat photos</a>.</li>

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

CamperBot
@camperbot
Sep 20 2015 20:22
:bulb: to format code use backticks! ``` more info
Hugo
@hugoender
Sep 20 2015 20:23
oops again lol
tva10
@tva10
Sep 20 2015 20:23
@hugoender you can edit message
John Oksasoglu
@oksas
Sep 20 2015 20:23
@MrDrBird hmm ok. I'll look into it
filip
@cymruu
Sep 20 2015 20:23
@oksas Im not in topic but maybe some templating system handlebars.js?
Hugo
@hugoender
Sep 20 2015 20:23
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

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

  .smaller-image {
    width: 100px;
  }
</style>

<h2 class="red-text">CatPhotoApp</h2>
<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat"></a>
<ul>
  <li>Click here for <a href="#">cat photos</a>.</li>

  <li class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</li>
  <li class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</li>
</ul>
MrDrBird
@MrDrBird
Sep 20 2015 20:23
@hugoender use back ticks... the one left of '1'
nice
tva10
@tva10
Sep 20 2015 20:23
@hugoender you did that :D
John Oksasoglu
@oksas
Sep 20 2015 20:23
@cymruu I'll check that out, for sure. thank you :D
CamperBot
@camperbot
Sep 20 2015 20:23
oksas sends brownie points to @cymruu :sparkles: :thumbsup: :sparkles:
:star: 4 | @cymruu | http://www.freecodecamp.com/cymruu
Hugo
@hugoender
Sep 20 2015 20:24
alright...
i keep getting an error
it says
Make sure your li element has a closing tag.
but they all have closing tags
is this a bug in the waypoint?
MrDrBird
@MrDrBird
Sep 20 2015 20:27
refresh your page
try again?
Leonardo Prates
@odran037
Sep 20 2015 20:27
Hello, everyone. Can someone shed some light on why you’d declare a variable to ‘this’?
var something = this;
What is the purpose of doing this? Is it strictly for readability?
Hugo
@hugoender
Sep 20 2015 20:27
@MrDrBird refreshed and still same error
MrDrBird
@MrDrBird
Sep 20 2015 20:27
@odran037 it assigns a value to an object
tommyosh
@tommyosh
Sep 20 2015 20:28
whats the waypoint name
MrDrBird
@MrDrBird
Sep 20 2015 20:28
objects can have lots of values
Hugo
@hugoender
Sep 20 2015 20:28
@tommyosh Waypoint: Create a Bulleted Unordered List
Coira Ellison
@Coira
Sep 20 2015 20:28
@odran037 do you know about scope in javascript?
Jhonnathan
@jhonnathan78
Sep 20 2015 20:28
hello everyone
can any one please help me understand http://freecodecamp.com/challenges/bonfire-reverse-a-string
CamperBot
@camperbot
Sep 20 2015 20:29
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Leonardo Prates
@odran037
Sep 20 2015 20:29
I do. I also understand what the keyword this is for. I’m just not understanding why you’d assign it to a variable.
Jhonnathan
@jhonnathan78
Sep 20 2015 20:29
the instructions seem to be incompleted
Karolis
@Luomint
Sep 20 2015 20:29
bonfire Falsy Bouncer
CamperBot
@camperbot
Sep 20 2015 20:29
Sorry, can't find a bonfire called falsy bouncer. [ Check the map? ]
Karolis
@Luomint
Sep 20 2015 20:29
Falsy Bouncer
Leonardo Prates
@odran037
Sep 20 2015 20:29
Since you can use it without a variable just as well.
Karolis
@Luomint
Sep 20 2015 20:29
bonfire falsy bouncer
CamperBot
@camperbot
Sep 20 2015 20:29
Sorry, can't find a bonfire called falsy bouncer. [ Check the map? ]
SojournerOctocat
@SojournerOctocat
Sep 20 2015 20:29
@jhonnathan78 How so?
tva10
@tva10
Sep 20 2015 20:29
@hugoender Hey, remove class element there, and it will be done
SojournerOctocat
@SojournerOctocat
Sep 20 2015 20:29
bf bouncer
CamperBot
@camperbot
Sep 20 2015 20:29

:fire:Bonfire: Falsey Bouncer :link:

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  return arr;
}

bouncer([7, 'ate', '', false, 9]);

Remove all falsey values from an array.

more info:  bf details | bf links | hint

Jhonnathan
@jhonnathan78
Sep 20 2015 20:30

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.

@SojournerOctocat
Karolis
@Luomint
Sep 20 2015 20:30
thanks @SojournerOctocat
CamperBot
@camperbot
Sep 20 2015 20:30
luomint sends brownie points to @sojourneroctocat :sparkles: :thumbsup: :sparkles:
Hugo
@hugoender
Sep 20 2015 20:30
@tva10 thank you! that fixed it.
CamperBot
@camperbot
Sep 20 2015 20:30
:star: 298 | @sojourneroctocat | http://www.freecodecamp.com/sojourneroctocat
hugoender sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:star: 236 | @tva10 | http://www.freecodecamp.com/tva10
Karolis
@Luomint
Sep 20 2015 20:30
hint
CamperBot
@camperbot
Sep 20 2015 20:30
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Jhonnathan
@jhonnathan78
Sep 20 2015 20:30
the are asking to turn the current string into an array and reverse it
Hugo
@hugoender
Sep 20 2015 20:30
@tva10 seems like a but to me though since they never say to remove class element
tva10
@tva10
Sep 20 2015 20:30
@hugoender it doesn't worked because test cases checks simple <li> element
Hugo
@hugoender
Sep 20 2015 20:30
like a bug*
Jhonnathan
@jhonnathan78
Sep 20 2015 20:30
but the string is as follows
SojournerOctocat
@SojournerOctocat
Sep 20 2015 20:30
@jhonnathan78 What have you tried so far?
Jhonnathan
@jhonnathan78
Sep 20 2015 20:30
reverseString("hello", "");
Leonardo Prates
@odran037
Sep 20 2015 20:31
@Coira right on. It does help. Thank you!
CamperBot
@camperbot
Sep 20 2015 20:31
odran037 sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 225 | @coira | http://www.freecodecamp.com/coira
SojournerOctocat
@SojournerOctocat
Sep 20 2015 20:31
bf reverse
CamperBot
@camperbot
Sep 20 2015 20:31

:fire:Bonfire: Reverse a String :link:

function reverseString(str) {
  return str;
}

reverseString('hello');

Reverse the provided string.

more info:  bf details | bf links | hint

SojournerOctocat
@SojournerOctocat
Sep 20 2015 20:31
bf links
tommyosh
@tommyosh
Sep 20 2015 20:31
@hugoender replace your p elements
dont change them to li

like totally replace them <ul>

  <li>milk</li>

  <li>cheese</li>

  <li>cheese</li>

</ul>

SojournerOctocat
@SojournerOctocat
Sep 20 2015 20:32
@jhonnathan78 The links given in the waypoint are actually helpful to reversing the given string. Have you reviewed String.split?
Coira Ellison
@Coira
Sep 20 2015 20:32
@odran037 np, it's one of those javascript "mistakes"
Jhonnathan
@jhonnathan78
Sep 20 2015 20:32

function reverseString(str) {
return str;
}

var array = ["hello", ""];

array = array.reverse();

reverseString(array);

Leonardo Prates
@odran037
Sep 20 2015 20:32
@Coira lol I see :)
Jhonnathan
@jhonnathan78
Sep 20 2015 20:33
I don't know if it is a mistake but the argument they are passing in the function looked more like an array
Hugo
@hugoender
Sep 20 2015 20:34
@tommyosh yeah that seems to have fixed the problem but they need to improve the error message
tva10
@tva10
Sep 20 2015 20:34
@jhonnathan78 nope, you can do that if you separate string into chars
Jhonnathan
@jhonnathan78
Sep 20 2015 20:34
I wonder if you have to remove the extra , " " from the whole thing and just keep "hello"
tva10
@tva10
Sep 20 2015 20:34
@jhonnathan78 use str.split('')
John Oksasoglu
@oksas
Sep 20 2015 20:34
@odran037 dunno if this will help at all after that stackoverflow link, but problem #3 from this page has an instance of what you're talking about: http://www.toptal.com/javascript/interview-questions
tva10
@tva10
Sep 20 2015 20:35
@jhonnathan78 and array.join('') to make string from reversed array
tommyosh
@tommyosh
Sep 20 2015 20:35
"Replace your p elements with an unordered list of three things that cats love". is pretty self explanatory
Hugo
@hugoender
Sep 20 2015 20:36
@tommyosh I did replace the p elements with li elements...but I kept the class
@tommyosh no where does it say not to keep the class
tva10
@tva10
Sep 20 2015 20:36
@tommyosh you can look what they mean in next step XD
Hugo
@hugoender
Sep 20 2015 20:37
@tva10 that is a good tip if i ever get stuck again...move to next waypoint lol
tva10
@tva10
Sep 20 2015 20:37
@tommyosh but there is a cheat
Jhonnathan
@jhonnathan78
Sep 20 2015 20:37
@SojournerOctocat I still don't get it
tva10
@tva10
Sep 20 2015 20:37
@hugoender I mean about what cat's love
@hugoender eating and sleeping etc
tommyosh
@tommyosh
Sep 20 2015 20:38
:D @tva10
Hugo
@hugoender
Sep 20 2015 20:38
@tva10 what? Im confused... what are we talking about now?
tommyosh
@tommyosh
Sep 20 2015 20:38
laser pointers
What cats love ;)
Hugo
@hugoender
Sep 20 2015 20:39
I know I didn't change the text in the lists but thats not the point
im trying to go through the initial tutorials a bit quickly to get to the meat of the stuff that I don't know
tva10
@tva10
Sep 20 2015 20:39
@hugoender I mean if you can't get point you should look at google or ask in chat
Hugo
@hugoender
Sep 20 2015 20:40
its fine you guys helped me and now im moving forward
tommyosh
@tommyosh
Sep 20 2015 20:40
Don't worry bout it bro, keep on movin :D
tva10
@tva10
Sep 20 2015 20:40
@hugoender I did that wat points in one evening
Jhonnathan
@jhonnathan78
Sep 20 2015 20:40
@tva10 can you please help me out
?
tva10
@tva10
Sep 20 2015 20:40
@hugoender because there are pretty easy
tva10
@tva10
Sep 20 2015 20:40
@jhonnathan78 okay
SojournerOctocat
@SojournerOctocat
Sep 20 2015 20:40
@jhonnathan78 Your array = array.reverse() results in [ '', 'hello' ]. Reverse reverses the elements within an array. hello is a string, not an array.
Leonardo Prates
@odran037
Sep 20 2015 20:41
@oksas thank you!
CamperBot
@camperbot
Sep 20 2015 20:41
odran037 sends brownie points to @oksas :sparkles: :thumbsup: :sparkles:
:star: 199 | @oksas | http://www.freecodecamp.com/oksas
tommyosh
@tommyosh
Sep 20 2015 20:41
Split it, reverse it and then join it
SojournerOctocat
@SojournerOctocat
Sep 20 2015 20:42
@jhonnathan78, @tva10 told you to use str.split() earlier. That statement turns a string into an array, so that "hello" would become ['h', 'e', 'l', 'l', 'o'].
Does that make things clearer?
tommyosh
@tommyosh
Sep 20 2015 20:43
Split the string, reverse the string and then join the string, in that order...
Jhonnathan
@jhonnathan78
Sep 20 2015 20:43

function reverseString(str) {
return str;
}

var array = ["hello", ""];

array = array.split();

array = array.reverse();

array = array.join();

reverseString(array);

here is what I got
and it did not work
tommyosh
@tommyosh
Sep 20 2015 20:43
you can do it with one line of code
Do you want the answer or more help?
Jhonnathan
@jhonnathan78
Sep 20 2015 20:44
more help
:)
don't give me the answer
SojournerOctocat
@SojournerOctocat
Sep 20 2015 20:44
@jhonnathan78 split works with strings, not arrays.
And you've given split an array to split.
tommyosh
@tommyosh
Sep 20 2015 20:44
ok heres a hint, it can be done with one line of code. Split the string, reverse the string and then join the string, in that order...
tva10
@tva10
Sep 20 2015 20:45
@jhonnathan78 look
var arr = str.split(''); // ['h' 'e' 'l' ...]
  arr = arr.reverse(); // reverse array
  str = arr.join(''); // makes a string
tommyosh
@tommyosh
Sep 20 2015 20:48
return str.split("").reverse().join("");
tva10
@tva10
Sep 20 2015 20:48
@tommyosh yep
tommyosh
@tommyosh
Sep 20 2015 20:49
i must start doing more of them now, i have a lot left :/
tva10
@tva10
Sep 20 2015 20:49
@tommyosh regExp tasks are the best of them
Aliaksandr Savitski
@pesokot
Sep 20 2015 20:50
Hi Guys! Can anyone help with Zipline: Build a Random Quote Machine
Can't add that damn API to the page. I have an error "parseQuote is not defined". But I've totally stuck with requesting those quotes :( everything works fine if I only add a quote once, but when I try to make the appear each time the button is clicked, I have this error.
<head>
  <div class="container">
    <div class="page-header text-center">
      <h1>Random Quotes</h1>
    </div>
  </div>
</head>
<section>
  <div class="container">
    <div class="row">
      <div class="col-md-12 col-xs-12 col-sm-12 text-center">
        <p id="quote-block">Some Quote</p>

      </div>
    </div>
    <div class="col-md-12 col-xs-12 col-sm-12 text-center">
      <a href="#" id="nxt-quote" class="btn btn-default">Next Quote</a>
      <script>
        $(document).ready(function() {
          $('a').click(function() {
              function parseQuote(response)
            {
                document.getElementById("quote-block").innerHTML = response.quoteText;
                document.getElementById("author").innerHTML = response.quoteAuthor;
            }

          });
        });
        </script>
    </div>
  </div>
  </div>
</section>
tva10
@tva10
Sep 20 2015 20:53
@pesokot where is your request to API?
John Oksasoglu
@oksas
Sep 20 2015 20:54
@pesokot it was a real headache for me using an api the first time. ^^, where's your call to the api?
tva10
@tva10
Sep 20 2015 20:55
@pesokot in click callback function you need to make request (via ajax), and after that you need to parse that response
Aliaksandr Savitski
@pesokot
Sep 20 2015 20:55
hmmm... that's a good question
moment
tva10
@tva10
Sep 20 2015 20:55
@oksas it is more simple with jQuery
John Oksasoglu
@oksas
Sep 20 2015 20:55
if you've got the code in a codepen and could share that too that could be helpful
@tva10 yeah I ended up using jQuery, it just took me a really long time to finally understand the entire process enough to be able to do it haha
Aliaksandr Savitski
@pesokot
Sep 20 2015 20:56
@oksas I have it, but not it's a big mess there
John Oksasoglu
@oksas
Sep 20 2015 20:57
ah okay
tva10
@tva10
Sep 20 2015 20:57
@oksas but I did that via XmlHttpRequests and understand that in university before//
Aliaksandr Savitski
@pesokot
Sep 20 2015 20:57
        function parseQuote(response)
            {
                document.getElementById("quote-block").innerHTML = response.quoteText;

          alert(response.quoteText);
John Oksasoglu
@oksas
Sep 20 2015 20:57
@tva10 yeah that was what I first tried haha. finally someone pointed me towards CORS so I understood why that wouldn't work
Aliaksandr Savitski
@pesokot
Sep 20 2015 20:58
jQuery.get("http://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&json=parseQuote&lang=en");
        function parseQuote(response)
            {
                document.getElementById("quote-block").innerHTML = response.quoteText;

          alert(response.quoteText);
sorry for spamming :D
John Oksasoglu
@oksas
Sep 20 2015 20:58
not at all
Aliaksandr Savitski
@pesokot
Sep 20 2015 20:59
I tried both, jQuery and XmlHttpRequests
nothing worked for me
maybe someone could pair and explain it to me
John Oksasoglu
@oksas
Sep 20 2015 21:00
hmmm. I've only really used $.ajax() and I still honestly have not the greatest understanding of it, so I can't see what would be wrong with your code here
tva10
@tva10
Sep 20 2015 21:00
and me too
John Oksasoglu
@oksas
Sep 20 2015 21:01
lemme stick your code in a pen and see if I see anything
Aliaksandr Savitski
@pesokot
Sep 20 2015 21:01
okay, give me a few minutes ;)
Kim Still
@twomoredays
Sep 20 2015 21:03
camperbot titlecase a sentence
camperbot
SojournerOctocat
@SojournerOctocat
Sep 20 2015 21:04
bf title
CamperBot
@camperbot
Sep 20 2015 21:04

: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

Kim Still
@twomoredays
Sep 20 2015 21:04
Thanks @SojournerOctocat
CamperBot
@camperbot
Sep 20 2015 21:04
twomoredays sends brownie points to @sojourneroctocat :sparkles: :thumbsup: :sparkles:
:star: 299 | @sojourneroctocat | http://www.freecodecamp.com/sojourneroctocat
Kim Still
@twomoredays
Sep 20 2015 21:04
hint
CamperBot
@camperbot
Sep 20 2015 21:04
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Aliaksandr Savitski
@pesokot
Sep 20 2015 21:05
John Oksasoglu
@oksas
Sep 20 2015 21:06
ok, I think I sort of see what the problem is
one sec
Mateja Trifunovski
@Matko95
Sep 20 2015 21:06
@pesokot it doesn't actually work for me
Aliaksandr Savitski
@pesokot
Sep 20 2015 21:06
how I have cross-domain
@Matko95 that's the point
Mateja Trifunovski
@Matko95
Sep 20 2015 21:06
oh i just joined :D sry
gonna check it out then
Aliaksandr Savitski
@pesokot
Sep 20 2015 21:07
@Matko95 No problem :)
Mateja Trifunovski
@Matko95
Sep 20 2015 21:07
@pesokot you are getting this error : XMLHttpRequest cannot load http://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&jsonp=parseQuote&lang=en. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://s.codepen.io' is therefore not allowed access
John Oksasoglu
@oksas
Sep 20 2015 21:07
@pesokot yeah so it's giving me a CORS error in the console. which means somehow your request is using just json I guess? and not jsonp
so give me a sec and I'll pull up my pen and compare. will also look into jQuery.get and see how that differs from $.ajax
Aliaksandr Savitski
@pesokot
Sep 20 2015 21:09
@oksas @Matko95 THank you guys!
CamperBot
@camperbot
Sep 20 2015 21:09
pesokot sends brownie points to @oksas and @matko95 :sparkles: :thumbsup: :sparkles:
:star: 200 | @oksas | http://www.freecodecamp.com/oksas
:star: 329 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 20 2015 21:09
@pesokot try using jsonp
Jordan Robertson
@Jordanson
Sep 20 2015 21:09
cannot tell what is wrong. Supposed to create a class called thick-green-border that puts a 10-pixel-wide green border with a style of solid around an HTML element, and apply that class to your cat photo. where is my issue
cannot tell what is wrong. Supposed to create a class called thick-green-border that puts a 10-pixel-wide green border with a style of solid around an HTML element, and apply that class to your cat photo. where is my issue
Mateja Trifunovski
@Matko95
Sep 20 2015 21:10
@pesokot
$.ajax({
  type: "POST",
  dataType: 'jsonp',
  ...... etc ....
something like that
@Jordanson could you post your code?
explain formatting
CamperBot
@camperbot
Sep 20 2015 21:10

: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

Aliaksandr Savitski
@pesokot
Sep 20 2015 21:10
@Matko95 should I define that?
give me a moment, please
Mateja Trifunovski
@Matko95
Sep 20 2015 21:11
sure :D
read up on ajax calls
Aliaksandr Savitski
@pesokot
Sep 20 2015 21:11
@Matko95 I did it this way:
$(document).ready(function() {
      $('a').click(function() {

        $.get("http://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&jsonp=parseQuote&lang=en");
        function parseQuote(response)
            {
                document.getElementById("quote-block").innerHTML = response.quoteText;
            }

      });
    });
John Oksasoglu
@oksas
Sep 20 2015 21:11
@Matko95 @pesokot I'm looking up ajax vs get, and it looks like get is just a shortcut for ajax. so I'm not really understanding why it wouldn't be working, but yeah I used ajax and it worked for me. if you want to see an example of using $.ajax() I would be happy to snip a bit from mine
Aliaksandr Savitski
@pesokot
Sep 20 2015 21:12
@oksas yes, please. Would much appreciate
Mateja Trifunovski
@Matko95
Sep 20 2015 21:12
@oksas as far as i understood, when using ajax you can force the JSONP and it allows communication
Jordan Robertson
@Jordanson
Sep 20 2015 21:12
cannot tell what is wrong. Supposed to creat