These are chat archives for FreeCodeCamp/Help

14th
Sep 2015
DaniNK
@DaniNK
Sep 14 2015 00:11

//Use map to add three to each value in the array
var array = [1,2,3,4,5];
// Only change code below this line.
array.map(function(val){
return val+3;
})

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

array.map is not a function
Can anyone help?
Jose M Viloria
@josevill
Sep 14 2015 00:17
@DaniNK You still there? Have you found out the mistake?
DaniNK
@DaniNK
Sep 14 2015 00:21
nope
still workin
any hint?
@josevill any hint
Jose M Viloria
@josevill
Sep 14 2015 00:23
@DaniNK You should assign your variable the outcome of using .map
DaniNK
@DaniNK
Sep 14 2015 00:25
I tried array=array.map(function(val){
...
still get the same error message
Jose M Viloria
@josevill
Sep 14 2015 00:31
Weird
Show me your whole code
@DaniNK
Moisés Man
@moigithub
Sep 14 2015 00:33
missing semicolon ?
Jose M Viloria
@josevill
Sep 14 2015 00:35
It can be
DaniNK
@DaniNK
Sep 14 2015 00:35

//Use map to add three to each value in the array
var array = [1,2,3,4,5];
// Only change code below this line.
array.map(function(val){
return val+3;
})

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

Jose M Viloria
@josevill
Sep 14 2015 00:35
Yes
Also
When pasting your code here
Do it properly, read this and you'll be all set :p
help formatting
CamperBot
@camperbot
Sep 14 2015 00:36

: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

DaniNK
@DaniNK
Sep 14 2015 00:38

```//Use map to add three to each value in the array
var array = [1,2,3,4,5];
// Only change code below this line.
array.map(function(val){
return val+3;
})

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

Jose M Viloria
@josevill
Sep 14 2015 00:40
You have to do it like this:
'''
your code
'''
CamperBot
@camperbot
Sep 14 2015 00:40
:bulb: to format code use backticks! ``` more info
Jose M Viloria
@josevill
Sep 14 2015 00:40
Also
Yes.
You're missing a semicolon
Moisés Man
@moigithub
Sep 14 2015 00:42
backticks ` instead of ' apostrophes
backticks MUST be on its own line.. with nothing else next to it
Jose M Viloria
@josevill
Sep 14 2015 00:42
I did it with apostrophes for the example
either way it wouldn't have worked for explaining :/
Moisés Man
@moigithub
Sep 14 2015 00:46
u can escape :)
```
code here
```
\`
Jose M Viloria
@josevill
Sep 14 2015 00:47
Oh sheit!
I didn't know that, you got me.
Props @moigithub
SojournerOctocat
@SojournerOctocat
Sep 14 2015 00:49
help format
CamperBot
@camperbot
Sep 14 2015 00:49

: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

Robert Waddington
@RobbWaddington
Sep 14 2015 00:49
I'm on the bf Palindrome and I can't figure out how I'm supposed to know what the things I can use in replace are.
I guess i'm not understanding how to use Regular Expressions
Jose M Viloria
@josevill
Sep 14 2015 00:50
bf palindrome
CamperBot
@camperbot
Sep 14 2015 00:50

:fire:Bonfire: Check for Palindromes :link:

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



palindrome("eye");

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

more info:  bf details | bf links | hint

Jose M Viloria
@josevill
Sep 14 2015 00:50
bf links
Jose M Viloria
@josevill
Sep 14 2015 00:51
@RobbWaddington Show us what you got
DJ Runas
@djrunas
Sep 14 2015 00:51
@josevill posted some great links to read up on if you're having trouble understanding RegEx, @RobbWaddington
But, ya, post what you have so far and we'll work from there! :)
Robert Waddington
@RobbWaddington
Sep 14 2015 00:52
I don't have any code really, I'm trying to understand what I need to use with .replace() to have it get rid of numbers, whitespace, and potential special chars
Jose M Viloria
@josevill
Sep 14 2015 00:52
Okay
Hmm
@RobbWaddington Do this exercises
DJ Runas
@djrunas
Sep 14 2015 00:53
Oh, I was just about to link that LOL
Robert Waddington
@RobbWaddington
Sep 14 2015 00:53
Sweet! Thanks @josevill and @djrunas
CamperBot
@camperbot
Sep 14 2015 00:53
robbwaddington sends brownie points to @josevill and @djrunas :sparkles: :thumbsup: :sparkles:
:star: 327 | @josevill | http://www.freecodecamp.com/josevill
:star: 176 | @djrunas | http://www.freecodecamp.com/djrunas
Robert Waddington
@RobbWaddington
Sep 14 2015 00:53
will do and return if I need more!
DJ Runas
@djrunas
Sep 14 2015 00:53
Let us know! :)
SojournerOctocat
@SojournerOctocat
Sep 14 2015 00:54
@RobbWaddington I had the same probelm when I started that bonfire. var newStr = str.replace(/\s+/g, '') gets rid of spaces.
DJ Runas
@djrunas
Sep 14 2015 00:54
Good luck, RegEx took me awhile to figure out~
Robert Waddington
@RobbWaddington
Sep 14 2015 00:57
okay so a \ indicates a metacharacter
and thusly \d and \s are digits and whitespace
DJ Runas
@djrunas
Sep 14 2015 00:57
Beautiful.
You're definitely on the right track!
Jose M Viloria
@josevill
Sep 14 2015 00:58
There's something that fulfills everything you need..
SojournerOctocat
@SojournerOctocat
Sep 14 2015 00:58
Yep.
DJ Runas
@djrunas
Sep 14 2015 00:58
^
Robert Waddington
@RobbWaddington
Sep 14 2015 00:58
just making sure that what I took from the first lesson on that site was correct
DaniNK
@DaniNK
Sep 14 2015 01:12
asdf
Anthony Albertorio
@tesla809
Sep 14 2015 01:12
hey hey !
DJ Runas
@djrunas
Sep 14 2015 01:12
Hey @tesla809 and @DaniNK
Anthony Albertorio
@tesla809
Sep 14 2015 01:13
I have a question
DJ Runas
@djrunas
Sep 14 2015 01:13
Having trouble with RegEx as well?
DaniNK
@DaniNK
Sep 14 2015 01:13
//Use map to add three to each value in the array
var array = [1,2,3,4,5];
// Only change code below this line.
array=array.map(function(val){
  return val+3;
})


// Only change code above this line.
(function() {return array;})();
DJ Runas
@djrunas
Sep 14 2015 01:13
Um, hold on.
Two different questions.
Anthony Albertorio
@tesla809
Sep 14 2015 01:14
Na, although I can understand the sentiment of being puzzled by it. The more I encounter it, the more it sort of makes sense
no worries, no rush on mine
DJ Runas
@djrunas
Sep 14 2015 01:14
What exactly is stumping you about the slot machine problem?
Jose M Viloria
@josevill
Sep 14 2015 01:15
@DaniNK Your code should look like this:
//Use map to add three to each value in the array
var array = [1,2,3,4,5];
// Only change code below this line.
array = array.map(function(val){
  return val+3;
});


// Only change code above this line.
(function() {return array;})();
@RobbWaddington Any progress yet?
Robert Waddington
@RobbWaddington
Sep 14 2015 01:16
I've got some code, and I've no idea why it's not doing what I want, lol
function palindrome(str) {
  // I'll need to either ignore case or make it all lowercase, I'll need to remove spaces and then test. testing will need to reverse strings and then compare them to the original, i think.
  var preTest = str.replace(/\s+/g, '').toLowerCase(); 
  var forTest = preTest.split('').reverse().join('');


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



palindrome("eye");
DJ Runas
@djrunas
Sep 14 2015 01:16
@RobbWaddington Now's the time to show us what you've got!
Robert Waddington
@RobbWaddington
Sep 14 2015 01:16
I'd be willing to bet i'm being silly
DJ Runas
@djrunas
Sep 14 2015 01:17
On the right track.
Right now, you're only removing white spaces.
Jose M Viloria
@josevill
Sep 14 2015 01:17
@RobbWaddington You'd want to use /[^A-Z]/gi Instead
DJ Runas
@djrunas
Sep 14 2015 01:17
^
Robert Waddington
@RobbWaddington
Sep 14 2015 01:17
I'd want to get rid of allllllll non letter chars?
Jose M Viloria
@josevill
Sep 14 2015 01:17
Yes
DJ Runas
@djrunas
Sep 14 2015 01:18
Gotta remove that punctuation.
That way you'll just have the letters to compare.
Robert Waddington
@RobbWaddington
Sep 14 2015 01:18
but one of the tests needs numbers.
would I need [^A-Z0-9]
DJ Runas
@djrunas
Sep 14 2015 01:19
:)
Try it out!
Jose M Viloria
@josevill
Sep 14 2015 01:19
It worked like that
For me when i tried
SojournerOctocat
@SojournerOctocat
Sep 14 2015 01:19
@RobbWaddington newStr.replace(/[\.,]/g, '') to remove punctuation.
Jose M Viloria
@josevill
Sep 14 2015 01:19
Let me check if they added new tests
Mateja Trifunovski
@Matko95
Sep 14 2015 01:20
bf symmetric difference
CamperBot
@camperbot
Sep 14 2015 01:20

:fire:Bonfire: Symmetric Difference :link:

function sym(args) {
  return arguments;
}

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

Create a function that takes two or more arrays and returns an array of the symmetric difference of the provided arrays.

more info:  bf details | bf links | hint

Mateja Trifunovski
@Matko95
Sep 14 2015 01:20
hint
CamperBot
@camperbot
Sep 14 2015 01:20
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
DaniNK
@DaniNK
Sep 14 2015 01:20
thanks @josevill
CamperBot
@camperbot
Sep 14 2015 01:20
danink sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 328 | @josevill | http://www.freecodecamp.com/josevill
DaniNK
@DaniNK
Sep 14 2015 01:20
it was only the semicolon
Jose M Viloria
@josevill
Sep 14 2015 01:20
@RobbWaddington Yes, they added a new test with numbers, you'll need that 0-9 inside the char set
Robert Waddington
@RobbWaddington
Sep 14 2015 01:21
that's still not working, it's only returning false.
DJ Runas
@djrunas
Sep 14 2015 01:21
[^A-Z0-9] isn't working?
Kolloom
@Kolloom
Sep 14 2015 01:21
actually /\w+/ is sufficient to get rid of non-word characters
Robert Waddington
@RobbWaddington
Sep 14 2015 01:21
function palindrome(str) {
  // I'll need to either ignore case or make it all lowercase, I'll need to remove spaces and then test. testing will need to reverse strings and then compare them to the original, i think.
  var preTest = str.replace(/[^A-Z0-9]/gi, '').toLowerCase(); 
  var forTest = preTest.split('').reverse().join('');


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



palindrome("eye");
that's only returning false.
Jose M Viloria
@josevill
Sep 14 2015 01:22
It won't ever return true
Robert Waddington
@RobbWaddington
Sep 14 2015 01:22
i've figured that out
lol
Kolloom
@Kolloom
Sep 14 2015 01:22
well try /\W+/ then
Jose M Viloria
@josevill
Sep 14 2015 01:22
Because you're comparing str to forTest
Anthony Albertorio
@tesla809
Sep 14 2015 01:22
@djrunas nothing really. I am just interested on why the .slot is wrapped up in $
Jose M Viloria
@josevill
Sep 14 2015 01:23
You have to compare it to preTest
DJ Runas
@djrunas
Sep 14 2015 01:23
:)
Robert Waddington
@RobbWaddington
Sep 14 2015 01:23
welp.... I'm silly
as I said
DJ Runas
@djrunas
Sep 14 2015 01:23
Such is life.
Good job though!
Robert Waddington
@RobbWaddington
Sep 14 2015 01:23
Thanks @josevill @SojournerOctocat @djrunas and @Kolloom for your help!
CamperBot
@camperbot
Sep 14 2015 01:23
robbwaddington sends brownie points to @josevill and @sojourneroctocat and @djrunas and @kolloom :sparkles: :thumbsup: :sparkles:
DJ Runas
@djrunas
Sep 14 2015 01:23
Aside from RegEx, everything else looked pretty great :)
CamperBot
@camperbot
Sep 14 2015 01:23
:warning: robbwaddington already gave josevill points
:star: 240 | @kolloom | http://www.freecodecamp.com/kolloom
:star: 286 | @sojourneroctocat | http://www.freecodecamp.com/sojourneroctocat
:warning: robbwaddington already gave djrunas points
Jose M Viloria
@josevill
Sep 14 2015 01:24
@RobbWaddington Keep it up. There are a lot more challenges to come. And you'll need to be ready >:)
Robert Waddington
@RobbWaddington
Sep 14 2015 01:24
I should've looked more closely at the tests. I think that would have tipped me off to the [^A-Z0-9]
DJ Runas
@djrunas
Sep 14 2015 01:25
Are you at least a little more comfortable with using RegEx now, @RobbWaddington ?
Robert Waddington
@RobbWaddington
Sep 14 2015 01:25
yea, I bookmarked that site too, in case I ever need to brush up
DJ Runas
@djrunas
Sep 14 2015 01:26
@tesla809 , such is the syntax for when you're grabbing an indexed selector.
Robert Waddington
@RobbWaddington
Sep 14 2015 01:26
I understand why [^A-Z0-9] is what I needed. I just didn't realize that I needed it at first
DJ Runas
@djrunas
Sep 14 2015 01:26
Oh, I see! That's good~
Let us know if you ever get stuck :)
Jose M Viloria
@josevill
Sep 14 2015 01:27
@RobbWaddington This one is where i practice my formulas
http://www.regexr.com/
Robert Waddington
@RobbWaddington
Sep 14 2015 01:27
bookmarked as well!
DJ Runas
@djrunas
Sep 14 2015 01:28
@tesla809 you're using $(".slot")because that is the selector we are trying to access
ooof, i still dont understand gitter
anyone know how to not make them reply?
Robert Waddington
@RobbWaddington
Sep 14 2015 01:28
what do you mean not make them reply?
DJ Runas
@djrunas
Sep 14 2015 01:29
UHHH, i mean like, they'll go under your messages
And sometimes they won't
Oh, @RobbWaddington , I'm taking a break at the Title Case Bonfire.
If you're gonna keep going with them, would you like to do that one with me?
Anthony Albertorio
@tesla809
Sep 14 2015 01:31
@djrunas aaa thanks for that
CamperBot
@camperbot
Sep 14 2015 01:31
tesla809 sends brownie points to @djrunas :sparkles: :thumbsup: :sparkles:
:star: 177 | @djrunas | http://www.freecodecamp.com/djrunas
DJ Runas
@djrunas
Sep 14 2015 01:31
@tesla809 you figure out the exercise though?
Robert Waddington
@RobbWaddington
Sep 14 2015 01:31
sure, it's a few ahead of me atm
DJ Runas
@djrunas
Sep 14 2015 01:31
Ya, just let me know, when you get there!
Robert Waddington
@RobbWaddington
Sep 14 2015 01:32
rather one, I can't count
DJ Runas
@djrunas
Sep 14 2015 01:32
And we can work on that one together :P
Anthony Albertorio
@tesla809
Sep 14 2015 01:32
@djrunas yup, it wasn't too difficult. I was just curious on why the notation was like that
@djrunas I will take up your offer on the algorithm scripting portion
Jose M Viloria
@josevill
Sep 14 2015 01:33
@djrunas @RobbWaddington I'll help you out if you both struggle with that one
DJ Runas
@djrunas
Sep 14 2015 01:33
Thanks @josevill :)
CamperBot
@camperbot
Sep 14 2015 01:33
djrunas sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 329 | @josevill | http://www.freecodecamp.com/josevill
DJ Runas
@djrunas
Sep 14 2015 01:33
Also, @tesla809 , just let us know if you ever need help on bonfires!
CamperBot
@camperbot
Sep 14 2015 01:33
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Mateja Trifunovski
@Matko95
Sep 14 2015 01:36
resetting on fatal plugin error what would that mean?
Robert Waddington
@RobbWaddington
Sep 14 2015 01:38
I sure hate when it only says "Unexpected token )" HOW AM I SUPPOSED TO KNOW WHICH ) DANGIT?
chicachicamji
@chicachicamji
Sep 14 2015 01:39
can anyone help me understand what the seek and destroy bonfire is asking to do? it says there are more than one argument in the function, but only displays one: arr
CamperBot
@camperbot
Sep 14 2015 01:39
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
BabyKosh
@badbabykosh
Sep 14 2015 01:40
OMG ... I'm driving myself nuts...I want to do "whatitis.grab()" and receive a string back....but alas not....what am I doing wrong?
function Weather(){

}

Weather.prototype.grab = function(){
  (function() {
    $.getJSON("http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=jsonp&lang=en&jsonp=?")
        .done(function (json) {
            var returnValue = json.quoteText;
            //document.getElementById("stuff").innerHTML = json.quoteText;
          returnFunc(returnValue);
        })
        .fail(function(jqxhr,textStatus,error){
          var err = textStatus +','+error;
          console.log('Shiz got broke: '+ err);
        });

  })();
};

function returnFunc(value){
  console.log("Fahuk "+value);
  value;
}
Rory Smith
@alanbuchanan
Sep 14 2015 01:40
@chicachicamji arguments will give you everything passed in to the function, even extra arguments that aren't 'expected'
SojournerOctocat
@SojournerOctocat
Sep 14 2015 01:42
@chicachicamji The arr is ([1, 2, 3, 1, 2, 3], 2, 3). The array you're testing is the one in brackets: [1, 2, 3, 1, 2, 3] and everything following the brackets (in this case, 2, 3 are the arguments to remove from the array you're testing.
Robert Waddington
@RobbWaddington
Sep 14 2015 01:45
can someone tell me why this ) is unexpected?
function findLongestWord(str) {
  //I'll need to split the string into an array and test the lengths of every word to see which is longest.
  var wordArray = str.split(' ');
  var long = 0;
  for (i = 0, i < wordArray.lenth - 1, i++){//the ")" in this line is unexpected... why?
    if (long < wordArray[i].length) {
       long = wordArray[i].length;
    }
  }


  return long;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
DJ Runas
@djrunas
Sep 14 2015 01:47
You have commas.
They should be ;’s
UHHHH, I think?
John Chau
@ydjjabt
Sep 14 2015 01:47
<html>
<script type="text/javascript" src='jquery.js'></script>
<style>
 #topRight a{

    float: right;
    color: #666666;
    text-decoration: none;
    font-size: small;
    font-family: Arial;
    padding: 5px 8px 5px 8px;
    list-style-type: none;
}

}
#logo{
   text-align: center;
}

.search{
    text-align: center;

}
</style>

<div id='topRight'>
<a href='#'> Gmail </a>
<a href='#'> Images </a>
<a href='#'> <img src='googlePage/bell.png'>  </a>
<a href='#'> Share </a>
<a href='#'> Scott </a>
</div>

<div class='search'>
    <img src='googlePage/google.png' width='275' height='95' id='logo'> 
    <input type='text' height='30' class='search'></input>

    <div class='search'>
        <button class='search'> Google Search </button>
        <button class='search'> I'm feeling Lucky </button>
    </div>
</div>



</html>
Robert Waddington
@RobbWaddington
Sep 14 2015 01:48
you are right @djrunas thanks for the second set of eyes
CamperBot
@camperbot
Sep 14 2015 01:48
robbwaddington sends brownie points to @djrunas :sparkles: :thumbsup: :sparkles:
:warning: robbwaddington already gave djrunas points
John Chau
@ydjjabt
Sep 14 2015 01:48
i need SERIOUS help aligning the Google logo, the search box, and the two search buttons in the center
Philip Warkentien II
@warkentien2
Sep 14 2015 01:49

@RobbWaddington @djrunas is correct.
however you CAN use commas for stuff like:

for( var i = 0, j = 0, output = []; i < str.length; i++, j++ ){ ... }

DJ Runas
@djrunas
Sep 14 2015 01:49
Thanks for clarifying, @warkentien2!
CamperBot
@camperbot
Sep 14 2015 01:49
djrunas sends brownie points to @warkentien2 :sparkles: :thumbsup: :sparkles:
:star: 285 | @warkentien2 | http://www.freecodecamp.com/warkentien2
Robert Waddington
@RobbWaddington
Sep 14 2015 01:49
that might be why I thought I used commas
Jose M Viloria
@josevill
Sep 14 2015 01:51
@ydjjabt Why are you building that? lol
Robert Waddington
@RobbWaddington
Sep 14 2015 01:52
sounds like the Project Odin first project
Jose M Viloria
@josevill
Sep 14 2015 01:52
Oh
Shouldn't he be looking for help @ their site or something? Some weird coding right there, lol
DJ Runas
@djrunas
Sep 14 2015 01:53
LOLOL
Anyone try out The Odin Project, though?
Robert Waddington
@RobbWaddington
Sep 14 2015 01:53
yea, I did not enjoy it.
i found that it didn't actually teach me much, and a few links they wanted you to learn from were broken, so I missed some things I guess.
Rafael J. Rodriguez
@Rafase282
Sep 14 2015 01:54
what is the odin project?
Rory Smith
@alanbuchanan
Sep 14 2015 01:54
TIL there are Future reserved keywords in javascript
DJ Runas
@djrunas
Sep 14 2015 01:55
The Odin Project is supposed to be a free full development platform much like Free Code Camp.
Except I believe there’s a heavier focus on Ruby On Rails.
BabyKosh
@badbabykosh
Sep 14 2015 01:55
function Weather(){

}

Weather.prototype.grab = function(){
  (function() {
    $.getJSON("http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=jsonp&lang=en&jsonp=?")
        .done(function (json) {
            var returnValue = json.quoteText;
            //document.getElementById("stuff").innerHTML = json.quoteText;
          returnFunc(returnValue);
        })
        .fail(function(jqxhr,textStatus,error){
          var err = textStatus +','+error;
          console.log('Shiz got broke: '+ err);
        });

  })();
};

function returnFunc(value){
  console.log("Fahuk "+value);
  value;
}
any idea why I am not getting this return value in "returnFunc()"???
Mateja Trifunovski
@Matko95
Sep 14 2015 01:55
I have a very strange issue, could someone help me out?
DJ Runas
@djrunas
Sep 14 2015 01:55
Tell us your problem, @Matko95 :)
@alanbuchanan :^)
Philip Warkentien II
@warkentien2
Sep 14 2015 01:57
@djrunas I had to learn Ruby + Rails in 1.5 weeks for this internship.
will definately check out Project Odin.
thanks
CamperBot
@camperbot
Sep 14 2015 01:57
warkentien2 sends brownie points to @djrunas :sparkles: :thumbsup: :sparkles:
Mateja Trifunovski
@Matko95
Sep 14 2015 01:57
Let's say arguments[0] is equal to [1, 2, 5], i assign a variable called pom as var pom=arguments[0] when i assign a new value of pom in a for loop, etc.pom=newArr it breaks the plugin
CamperBot
@camperbot
Sep 14 2015 01:57
:star: 178 | @djrunas | http://www.freecodecamp.com/djrunas
BabyKosh
@badbabykosh
Sep 14 2015 01:57
kosh gets no luv?
John Chau
@ydjjabt
Sep 14 2015 01:57
@josevill alignment is bugging me so i need to practice
Rory Smith
@alanbuchanan
Sep 14 2015 01:58
@Matko95 could you post your code?
Mateja Trifunovski
@Matko95
Sep 14 2015 01:58
well it's messy, i'm just trying to figure out something
but here it goes
@alanbuchanan
function sym(args) {
  var symDiff=[];
  var pom= arguments[0];

  if(arguments.length===2)
    {
      for(var i=0;i<arguments[1].length;i++)
        {
           if(arguments[0].indexOf(arguments[1][i])===-1)
    {
               symDiff.push(arguments[1][i]);
             }
        }
      for(var i=0;i<arguments[0].length;i++)
        {
           if(arguments[1].indexOf(arguments[0][i])===-1)
             {
               symDiff.push(arguments[0][i]);
             }
        }

    }
  else if(arguments.length>2)
    {
      for(var i=1;i<arguments.length;i++)
        {
          for(var j=0;j<arguments[i].length;j++)
        {
           if(pom.indexOf(arguments[i][j])===-1)
             {
               symDiff.push(arguments[i][j]);
             }
        }
      for(var k=0;k<pom.length;k++)
        {
           if(arguments[i].indexOf(pom[k])===-1)
             {
               symDiff.push(pom[k]);
             }
        }
          console.log(symDiff);
          //pom=symDiff;
        }
    }
  return symDiff;
}

sym([1, 2, 5], [2, 3, 5], [3, 4, 5]);
the part that is commented out is the problem
Philip Warkentien II
@warkentien2
Sep 14 2015 02:00
@Matko95 should arguments length === 1 return an empty array?
Robert Waddington
@RobbWaddington
Sep 14 2015 02:01
could someone explain to me why the value isn't being written for my var word inside my if loop inside my for loop
DJ Runas
@djrunas
Sep 14 2015 02:02
Post code.
Mateja Trifunovski
@Matko95
Sep 14 2015 02:02
@warkentien2 I guess.. but it always has 2 or more args
Robert Waddington
@RobbWaddington
Sep 14 2015 02:02
function findLongestWord(str) {
  //I'll need to split the string into an array and test the lengths of every word to see which is longest.
  str = str.split(' ');
  var long = 0;
  var word = null;
  for (i = 0; i < str.lenth; i++){
    if (long < str[i].length) {
       long = str[i].length;
       word = str[i];
    }
  }
  return word.length;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
DJ Runas
@djrunas
Sep 14 2015 02:02
word can be set to 0.
Jose M Viloria
@josevill
Sep 14 2015 02:02
@Matko95 There's something breaking your code way earlier than what you commented
Robert Waddington
@RobbWaddington
Sep 14 2015 02:03
that makes it return undefined
Jose M Viloria
@josevill
Sep 14 2015 02:03
Yo
You have to
Mateja Trifunovski
@Matko95
Sep 14 2015 02:03
@josevill but it doesn't break when i comment it out, do you know what?
Jose M Viloria
@josevill
Sep 14 2015 02:03
@RobbWaddington You have to
Robert Waddington
@RobbWaddington
Sep 14 2015 02:04
I have to wha?
Jose M Viloria
@josevill
Sep 14 2015 02:04
Well, it's just a thought.. You could pass "word" the length or str[i], instead of the word..
@Matko95 I tried running your code through JSLint and it couldn't finish testing it..
Mateja Trifunovski
@Matko95
Sep 14 2015 02:04
Badass code :D
Philip Warkentien II
@warkentien2
Sep 14 2015 02:05
sym() was the hardest bonfire. Specially if you do it for n > 3
I used 5 helper function.
DJ Runas
@djrunas
Sep 14 2015 02:05
LOL, I like that, @Matko95 :)
Robert Waddington
@RobbWaddington
Sep 14 2015 02:06
It's not doing anything inside of the loop though, as far as I can tell nothing is being changed.
long returns 0 and word returns null
which makes me think my loop isn't doing what I want
Philip Warkentien II
@warkentien2
Sep 14 2015 02:06
@badbabykosh there's a way better chance at finding help in room HelpZiplines
Mateja Trifunovski
@Matko95
Sep 14 2015 02:07
@warkentien2 well i feel like i'm close to the solution, but it breaks
The first if statement works
Jose M Viloria
@josevill
Sep 14 2015 02:07
@RobbWaddington I feel like i have an idea what's going on
@RobbWaddington hold up
Robert Waddington
@RobbWaddington
Sep 14 2015 02:08
@josevill I'm all ears, because I feel like I should see it but I can't step far enough out of my own code
DJ Runas
@djrunas
Sep 14 2015 02:08
@RobbWaddington, figure out a way to keep track of the greatest current length as you loop.
You’re going to want to figure out the length of the current word and see if its greater than the previous word.
Robert Waddington
@RobbWaddington
Sep 14 2015 02:09
guys
guys
Rex Schrader
@SaintPeter
Sep 14 2015 02:10
guys?
Robert Waddington
@RobbWaddington
Sep 14 2015 02:10
function findLongestWord(str) {
  //I'll need to split the string into an array and test the lengths of every word to see which is longest.
  str = str.split(' ');
  var long = 0;
  var word = null;
  for (i = 0; i < str.lenth; i++){
    if (long < str[i].length) {
       long = str[i].length;
       word = str[i];
    }
  }
  return word.length;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
DJ Runas
@djrunas
Sep 14 2015 02:10
If it is, then reassign that value.
Robert Waddington
@RobbWaddington
Sep 14 2015 02:10
see my for loop
Mateja Trifunovski
@Matko95
Sep 14 2015 02:10
[3, 1, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.................] i figured out it makes something like this :D
Robert Waddington
@RobbWaddington
Sep 14 2015 02:10
note, lenth not length....
DJ Runas
@djrunas
Sep 14 2015 02:10
That’s important as well.
Robert Waddington
@RobbWaddington
Sep 14 2015 02:10
spelling errors conquer me once again
the code worked with that one change
DJ Runas
@djrunas
Sep 14 2015 02:10
Doge bless.
Rex Schrader
@SaintPeter
Sep 14 2015 02:10
@RobbWaddington Why are you storing the entire word and not just the word's length?
Philip Warkentien II
@warkentien2
Sep 14 2015 02:10
@SaintPeter what up?
Robert Waddington
@RobbWaddington
Sep 14 2015 02:10
right
Rex Schrader
@SaintPeter
Sep 14 2015 02:11
@warkentien2 Oh, I was just saying "guys" along with @RobbWaddington
Jose M Viloria
@josevill
Sep 14 2015 02:11
@SaintPeter I was about to say that
DJ Runas
@djrunas
Sep 14 2015 02:11
Your code works.
Robert Waddington
@RobbWaddington
Sep 14 2015 02:11
i mean long has the length does it not?
Philip Warkentien II
@warkentien2
Sep 14 2015 02:11
@SaintPeter no prob.
DJ Runas
@djrunas
Sep 14 2015 02:11
But, it could be cleaned up.
Jose M Viloria
@josevill
Sep 14 2015 02:11
@SaintPeter Always a few steps ahead, lol !
@RobbWaddington Yes
Robert Waddington
@RobbWaddington
Sep 14 2015 02:11
I took word = str[i]: out
DJ Runas
@djrunas
Sep 14 2015 02:11
just return length
Robert Waddington
@RobbWaddington
Sep 14 2015 02:12
it did nothing and I was mostly using it to test
DJ Runas
@djrunas
Sep 14 2015 02:12
return long*
oh.
tests are cool.
Robert Waddington
@RobbWaddington
Sep 14 2015 02:12
i am returning long now
lol, I was just at a loss and wanted another variable to test
function findLongestWord(str) {
  //I'll need to split the string into an array and test the lengths of every word to see which is longest.
  str = str.split(' ');
  var long = 0;
  for (i = 0; i < str.length; i++){
    if (long < str[i].length) {
       long = str[i].length;

    }
  }
  return long;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
see it's cleaner now
Jose M Viloria
@josevill
Sep 14 2015 02:12
Cool :)
Rex Schrader
@SaintPeter
Sep 14 2015 02:12
@RobbWaddington But . . will it blend?
DJ Runas
@djrunas
Sep 14 2015 02:12
beautiful. :)
Kolloom
@Kolloom
Sep 14 2015 02:12
This message was deleted
Robert Waddington
@RobbWaddington
Sep 14 2015 02:13
Most things will @SaintPeter
DJ Runas
@djrunas
Sep 14 2015 02:13
He fixed str.length.
Robert Waddington
@RobbWaddington
Sep 14 2015 02:13
lol
Aniruddha Barapatre
@aniruddhabarapatre
Sep 14 2015 02:13
function palindrome(str) {
  var original = str.replace("/\w+/gi","").toLowerCase();
  var reverse = original.split("").reverse().join("");

  if (original === reverse) {
   return true; 
  } else {
    return false;
  }
}

palindrome("eye");
Any help on this palindrome code?
Robert Waddington
@RobbWaddington
Sep 14 2015 02:13
thanks @Kolloom even if it was a little late
CamperBot
@camperbot
Sep 14 2015 02:13
robbwaddington sends brownie points to @kolloom :sparkles: :thumbsup: :sparkles:
:warning: robbwaddington already gave kolloom points
Jose M Viloria
@josevill
Sep 14 2015 02:13
Firefox has encountered a bug!
http://i.imgur.com/ULXWXsV.gifv
Rex Schrader
@SaintPeter
Sep 14 2015 02:13
@aniruddhabarapatre Your regular expression is incorrect. Go give it a try over at http://regex101.com
DJ Runas
@djrunas
Sep 14 2015 02:14
You’re on the right track, though @aniruddhabarapatre
Robert Waddington
@RobbWaddington
Sep 14 2015 02:14
I just conquered that bf with help from this room
Rex Schrader
@SaintPeter
Sep 14 2015 02:14
@aniruddhabarapatre You are REALLY close, though.
Robert Waddington
@RobbWaddington
Sep 14 2015 02:14
quite actually
@djrunas I'm on that Title Case bf now
Philip Warkentien II
@warkentien2
Sep 14 2015 02:15
@Matko95 now back to you
Robert Waddington
@RobbWaddington
Sep 14 2015 02:15
my b
DJ Runas
@djrunas
Sep 14 2015 02:15
@aniruddhabarapatre \w will match any alphanumeric character.
Rex Schrader
@SaintPeter
Sep 14 2015 02:15
@djrunas SShhh - let him use the site! Self discovery is important :D
DJ Runas
@djrunas
Sep 14 2015 02:15
OH
Robert Waddington
@RobbWaddington
Sep 14 2015 02:15
lol
DJ Runas
@djrunas
Sep 14 2015 02:15
YES
YOU ARE RIGHT!
Oh, cool.
Title case, Robb!~
Mateja Trifunovski
@Matko95
Sep 14 2015 02:15
@warkentien2 i figured out, that it actually works, but it starts pushing alot of "1"s when it ends [3, 1, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1....]
@warkentien2 and the solution is [3,1,4,5]
DJ Runas
@djrunas
Sep 14 2015 02:16
Let’s PM each other when working on this one together so this place doesn’t get too cluttered @RobbWaddington
Robert Waddington
@RobbWaddington
Sep 14 2015 02:16
right
Philip Warkentien II
@warkentien2
Sep 14 2015 02:16
@Matko95 you can PM
the code
Jose M Viloria
@josevill
Sep 14 2015 02:17
@RobbWaddington @djrunas If you're up, we can set up a kobra.io room and work that one out there :)
DJ Runas
@djrunas
Sep 14 2015 02:17
kobra.io?
Interesting!
Never heard of it :)
Would you like to set one up, @josevill?
Jose M Viloria
@josevill
Sep 14 2015 02:18
Going in.
Join me
Aniruddha Barapatre
@aniruddhabarapatre
Sep 14 2015 02:22
@SaintPeter @djrunas Still not clear what I should be looking for? I was assuming I'm missing check for \s and \?
Rex Schrader
@SaintPeter
Sep 14 2015 02:22
@aniruddhabarapatre The issue is that you're trying to remove non-alphanumeric characters, right?
Aniruddha Barapatre
@aniruddhabarapatre
Sep 14 2015 02:23
Yes
Rex Schrader
@SaintPeter
Sep 14 2015 02:24
@aniruddhabarapatre Regular expressions don't go in quotes:
str.replace("/\w+/gi",""); // Wrong
str.replace(/\w+/gi,""); // Right
Aniruddha Barapatre
@aniruddhabarapatre
Sep 14 2015 02:25
Ahhh...RegEx always my kryptonite. Thanks @SaintPeter. Also Thanks to @djrunas
CamperBot
@camperbot
Sep 14 2015 02:25
aniruddhabarapatre sends brownie points to @saintpeter and @djrunas :sparkles: :thumbsup: :sparkles:
:star: 598 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 180 | @djrunas | http://www.freecodecamp.com/djrunas
Rex Schrader
@SaintPeter
Sep 14 2015 02:26
@aniruddhabarapatre But \w is still the inverse of what you need.
@aniruddhabarapatre \w matches [a-zA-Z0-9_]
Aniruddha Barapatre
@aniruddhabarapatre
Sep 14 2015 02:27
so anything other than \w
Rory Smith
@alanbuchanan
Sep 14 2015 02:31
just playing with reduce, and i don't understand the result of this. i'm probably just not grasping reduce but i don't see why a number can't be passed through the chain
Aniruddha Barapatre
@aniruddhabarapatre
Sep 14 2015 02:33
@SaintPeter Still lost. Do I have to negate that w+ or do any pattern match test?
Rex Schrader
@SaintPeter
Sep 14 2015 02:34
@aniruddhabarapatre You have to negate it.
@aniruddhabarapatre or inverse it
@aniruddhabarapatre There exists an inverse of \w.
Rory Smith
@alanbuchanan
Sep 14 2015 02:36
@aniruddhabarapatre @SaintPeter gave you this link which literally tells you the answer somewhere on the page :stuck_out_tongue:
Rex Schrader
@SaintPeter
Sep 14 2015 02:36
@alanbuchanan now now - s/he's getting there. I'm totally resisting the urge to give him/her the answer.
Rory Smith
@alanbuchanan
Sep 14 2015 02:37
just a hint :)
Rex Schrader
@SaintPeter
Sep 14 2015 02:37
@alanbuchanan His very name means "uncontrolled", "unrestrained" or "without obstacles"
CamperBot
@camperbot
Sep 14 2015 02:37
:trollface: troll problems? notify admins here
Rory Smith
@alanbuchanan
Sep 14 2015 02:38
@SaintPeter are you multilingual?
Rex Schrader
@SaintPeter
Sep 14 2015 02:39
@alanbuchanan Everone is multilingual when they have google ;)
Mateja Trifunovski
@Matko95
Sep 14 2015 02:39
@warkentien2 thanks :)
CamperBot
@camperbot
Sep 14 2015 02:39
matko95 sends brownie points to @warkentien2 :sparkles: :thumbsup: :sparkles:
:star: 286 | @warkentien2 | http://www.freecodecamp.com/warkentien2
Rory Smith
@alanbuchanan
Sep 14 2015 02:40
:)
@SaintPeter can you help point out why i am not understanding my reduce logic?
Rex Schrader
@SaintPeter
Sep 14 2015 02:41
@alanbuchanan I work with a bunch of folks from India and Malaysia, so I usually google first names to figure out gender.
@alanbuchanan I can try ;)
Aniruddha Barapatre
@aniruddhabarapatre
Sep 14 2015 02:41
@alanbuchanan @SaintPeter believe me I started with \W, it's just last test that's making me go bonkers
Rory Smith
@alanbuchanan
Sep 14 2015 02:41
@SaintPeter i see
@aniruddhabarapatre yeah, that one was recently added :)
@aniruddhabarapatre i don't like it...
Rex Schrader
@SaintPeter
Sep 14 2015 02:42
@aniruddhabarapatre Well, that's the correct thing. What I would suggest next is putting a console.log statement on your str and reverse statements right before you compare them.
@aniruddhabarapatre It's probably worth copying the test case text up into your work area
@alanbuchanan You gonna shoot me some code or something for reduce?
Rory Smith
@alanbuchanan
Sep 14 2015 02:46
SaintPeter @SaintPeter peers at @alanbuchanan 's code
Rory Smith
@alanbuchanan
Sep 14 2015 02:46
:)
Rex Schrader
@SaintPeter
Sep 14 2015 02:47
@alanbuchanan ok, so your numeric solution is not working?
Rory Smith
@alanbuchanan
Sep 14 2015 02:47
right
returns 3, i think because the last word is length 3, and it's just returning that
chicachicamji
@chicachicamji
Sep 14 2015 02:48
can someone help troubleshoot this code?
function destroyer(arr) {
  // Remove all the values
  var newArray = [];
  for(var x = 0; x < arr.length; x++) {
    for(var y = 1; y < arguments.length; y++) {
      if(arr[x] !== arguments[y]) {
        newArray.push(arr[x]);
      }
    }
  }
  return newArray;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Rory Smith
@alanbuchanan
Sep 14 2015 02:48
in which case the value isn't being 'passed through'
Rex Schrader
@SaintPeter
Sep 14 2015 02:48
@alanbuchanan Ok, the problem is that on the first item you test, prev is a string. But as soon as you do the first return, prev is now numeric.
@alanbuchanan So, the thing to do is to pass an initial value of prev - look at the reduce MDN page and you'll see that it takes 2 params: The callback and an initial value. Pass an initial value of 0, then do all the comparisons assuming a numeric prev
Aniruddha Barapatre
@aniruddhabarapatre
Sep 14 2015 02:50
@SaintPeter How come they're checking 0_0 (: /-\ :) 0-0 for palindrome. This isn't, unless hyphen and underscore are same.
Rex Schrader
@SaintPeter
Sep 14 2015 02:51
@aniruddhabarapatre They're doing it to make sure that you understand that /\W/ === [^a-zA-Z0-9_] - You have to take into account the underscore. You can do that by putting \W into a character class with _
Victor Hernandez
@Theviajerock
Sep 14 2015 02:54
Hi people
Somebody by here?
Rex Schrader
@SaintPeter
Sep 14 2015 02:54
Yup
We've got a regular wrecking crew
Rory Smith
@alanbuchanan
Sep 14 2015 02:55
@SaintPeter i'm still not getting it :anguished:
Victor Hernandez
@Theviajerock
Sep 14 2015 02:55
Jeje
I need some help... I am in the portfolio project.
Until now i have this...
SojournerOctocat
@SojournerOctocat
Sep 14 2015 02:55
@chicachicamji I used slice to get the arguments 2, 3 separated from the array.
Rex Schrader
@SaintPeter
Sep 14 2015 02:56
@alanbuchanan put a console.log statement inside your reduce callback and look at the value of prev
@Theviajerock ok - I love your project image placeholder - awesome images.
Victor Hernandez
@Theviajerock
Sep 14 2015 02:57
And... i have one doubt... WHen i resize the screen and put it small... The navbar cover the second part...
@SaintPeter Thanks : D
CamperBot
@camperbot
Sep 14 2015 02:57
theviajerock sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 600 | @saintpeter | http://www.freecodecamp.com/saintpeter
Philip Warkentien II
@warkentien2
Sep 14 2015 02:57
@alanbuchanan where's your code. I can explain
Aniruddha Barapatre
@aniruddhabarapatre
Sep 14 2015 02:58
Thanks @SaintPeter for pointing in right direction.
CamperBot
@camperbot
Sep 14 2015 02:58
aniruddhabarapatre sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: aniruddhabarapatre already gave saintpeter points
Rex Schrader
@SaintPeter
Sep 14 2015 02:58
@aniruddhabarapatre :D
Rory Smith
@alanbuchanan
Sep 14 2015 02:59
Screen Shot 2015-09-14 at 03.59.00.png
i understand this but i don't know how to change the behaviour of it
Philip Warkentien II
@warkentien2
Sep 14 2015 03:00
what are you trying to change?
Rory Smith
@alanbuchanan
Sep 14 2015 03:00
@warkentien2
Rex Schrader
@SaintPeter
Sep 14 2015 03:00
@alanbuchanan https://repl.it/BHjf/6
@Theviajerock Humm, that's interesting, I'm trying to figure out why that is.
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:01
i have one prob with the portfolio challenge, im using scrollspy, but it always select the last element after i reload the page
Jose M Viloria
@josevill
Sep 14 2015 03:02
@djrunas @RobbWaddington my ISP and firefox are doing their thing right now.
Victor Hernandez
@Theviajerock
Sep 14 2015 03:02
Yes @SaintPeter
Rory Smith
@alanbuchanan
Sep 14 2015 03:02
@SaintPeter hmmmmmm that's certainly making me think
Jose M Viloria
@josevill
Sep 14 2015 03:02
If you have any doubts, shoot me a pm, i'm almost always here
Victor Hernandez
@Theviajerock
Sep 14 2015 03:03
First... i see that when i top-fix my navbar i have to configure my body margin to 70%
DJ Runas
@djrunas
Sep 14 2015 03:03
@josevill Aiight.
Victor Hernandez
@Theviajerock
Sep 14 2015 03:03
And it works in normal size, but not in small size.
DJ Runas
@djrunas
Sep 14 2015 03:03
Also thanks again @josevill and @RobbWaddington
CamperBot
@camperbot
Sep 14 2015 03:03
djrunas sends brownie points to @josevill and @robbwaddington :sparkles: :thumbsup: :sparkles:
:star: 330 | @josevill | http://www.freecodecamp.com/josevill
:star: 179 | @robbwaddington | http://www.freecodecamp.com/robbwaddington
Rex Schrader
@SaintPeter
Sep 14 2015 03:03
@alanbuchanan You could also fix it by having an if statement that checked typeof prev === 'string', but that seems wasteful
Rory Smith
@alanbuchanan
Sep 14 2015 03:03
@SaintPeter of course. it's clicking now why i need to test prev alone and then curr.length. still not sure about the initial value though
Robert Waddington
@RobbWaddington
Sep 14 2015 03:03
Thanks @josevill and @djrunas for all the help just now!
CamperBot
@camperbot
Sep 14 2015 03:03
robbwaddington sends brownie points to @josevill and @djrunas :sparkles: :thumbsup: :sparkles:
:star: 331 | @josevill | http://www.freecodecamp.com/josevill
:star: 181 | @djrunas | http://www.freecodecamp.com/djrunas
DJ Runas
@djrunas
Sep 14 2015 03:03
Is it weird if I put Robb as my pair partner?
Jose M Viloria
@josevill
Sep 14 2015 03:04
@djrunas All cool
You have to put up his fcc username
Anusha Suresh
@anushasuresh89
Sep 14 2015 03:04
I am having a problem with the palindrom program.. The case, "0_0 (: /-\ :) 0-0" is failing. The code I wrote is as follows

function palindrome(str) {
// Good luck!
str=str.match(/\w/g).join('').toLowerCase();
//console.log(str);
var strNew=str.split('').reverse().join('');
//console.log(strNew);
if(str==strNew)
return true;
else
return false;
}

palindrome("eye");

DJ Runas
@djrunas
Sep 14 2015 03:04
What’s your FCC username, Robb?
Anusha Suresh
@anushasuresh89
Sep 14 2015 03:04
can anyone help me?
DJ Runas
@djrunas
Sep 14 2015 03:04
I would assume the same thing, correct?
Robert Waddington
@RobbWaddington
Sep 14 2015 03:04
as it is here I beleive
Rex Schrader
@SaintPeter
Sep 14 2015 03:05
@alanbuchanan If you don't put an initial value, then prev = arr[0] and curr = arr[1] on the first loop. If you put an initial value then prev = initialValue and curr = arr[0]
Rory Smith
@alanbuchanan
Sep 14 2015 03:05
@SaintPeter is it to force the inital value of prev to be numeric?
Rex Schrader
@SaintPeter
Sep 14 2015 03:05
Rory Smith
@alanbuchanan
Sep 14 2015 03:05
ohhhhhhh
bloody hell.....
DJ Runas
@djrunas
Sep 14 2015 03:05
@anushasuresh89 your regular expression is close!
Mateja Trifunovski
@Matko95
Sep 14 2015 03:05
@alanbuchanan str=str.match(/\w/g).join('').toLowerCase(); try using \W "the w is in caps"
kmo1
@kmo1
Sep 14 2015 03:05
@anushasuresh89 - your code seems to work for me but I had to clean it up a bit
Mateja Trifunovski
@Matko95
Sep 14 2015 03:06
@anushasuresh89 str=str.match(/\w/g).join('').toLowerCase(); try using \W "the w is in caps"
Rex Schrader
@SaintPeter
Sep 14 2015 03:06
@alanbuchanan You are not the only one who's mind has been blown by this fact.
kmo1
@kmo1
Sep 14 2015 03:06
function palindrome(str) {
    // Good luck!
    str=str.match(/\w/g).join('').toLowerCase();

    var strNew=str.split('').reverse().join('');

    if(str==strNew){
        return true;    
    }

    else{
        return false;    
    }

}
palindrome("0dsd_0");
Mateja Trifunovski
@Matko95
Sep 14 2015 03:06
sorry @alanbuchanan about that :D
chicachicamji
@chicachicamji
Sep 14 2015 03:06
can someone help troubleshoot my code?
function destroyer(arr) {
  // Remove all the values
  var newArray = [];
  for(var x = 0; x < arr.length; x++) {
    for(var y = 1; y < arguments.length; y++) {
      if(arr[x] !== arguments[y]) {
        newArray.push(arr[x]);
      }
    }
  }
  return newArray;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Rex Schrader
@SaintPeter
Sep 14 2015 03:07
@kmo1 You're using match when you should be using replace, and your regular expression is wrong. Try out a new one at http://regex101.com.
Rory Smith
@alanbuchanan
Sep 14 2015 03:07
@SaintPeter it's so nice to finally understand it. thank you for explaining it
CamperBot
@camperbot
Sep 14 2015 03:07
alanbuchanan sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 601 | @saintpeter | http://www.freecodecamp.com/saintpeter
kmo1
@kmo1
Sep 14 2015 03:07
@SaintPeter I'm just using @anushasuresh89 code
Aniruddha Barapatre
@aniruddhabarapatre
Sep 14 2015 03:08
Seems like that last test gonna cause trouble for everyone in palindrome.
DJ Runas
@djrunas
Sep 14 2015 03:08
@anushasuresh89 As Saintpeter said, you should use .replace() and figure out the correct regular expression :)
Rex Schrader
@SaintPeter
Sep 14 2015 03:08
@chicachicamji The problem is that you're pushing the number if it doesn't match arguments[y] - but if there are more than one arguments[y], one of them might match while the other does not.
DJ Runas
@djrunas
Sep 14 2015 03:08
If you need some help understanding regular expressions here’s a great tutorial site! http://regexone.com/
Rex Schrader
@SaintPeter
Sep 14 2015 03:08
@kmo1 Steal code from a better source ;)
chicachicamji
@chicachicamji
Sep 14 2015 03:09
@SaintPeter that's what I was thinking, thanks
CamperBot
@camperbot
Sep 14 2015 03:09
chicachicamji sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 602 | @saintpeter | http://www.freecodecamp.com/saintpeter
kmo1
@kmo1
Sep 14 2015 03:09
@SaintPeter she had asked for help so I tested it and reposted....
DJ Runas
@djrunas
Sep 14 2015 03:09
LOL, @SaintPeter, she posted asking for some help but it was just text.
Rex Schrader
@SaintPeter
Sep 14 2015 03:09
@djrunas Oh, D'oh
DJ Runas
@djrunas
Sep 14 2015 03:09
:)
Mateja Trifunovski
@Matko95
Sep 14 2015 03:09
It's funny how FCC is the most active when it's 5am here :D
DJ Runas
@djrunas
Sep 14 2015 03:09
Where are you from, Mat?
Mateja Trifunovski
@Matko95
Sep 14 2015 03:09
Serbia,Europe
DJ Runas
@djrunas
Sep 14 2015 03:09
That’s really cool!
Mateja Trifunovski
@Matko95
Sep 14 2015 03:09
guess everyone here is from America :D
DJ Runas
@djrunas
Sep 14 2015 03:09
But, shouldn’t you get some rest? LOL
Rex Schrader
@SaintPeter
Sep 14 2015 03:10
@anushasuresh89 You're using match when you should be using replace, and your regular expression is wrong. Try out a new one at http://regex101.com.
Rory Smith
@alanbuchanan
Sep 14 2015 03:10
@Matko95 i experience the same :)
Mateja Trifunovski
@Matko95
Sep 14 2015 03:10
@djrunas I'm a night owl :D atleast until my college starts again
DJ Runas
@djrunas
Sep 14 2015 03:10
Same here, @Matko95
Victor Hernandez
@Theviajerock
Sep 14 2015 03:10
Jaja I am not from America
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:10
so fas so good, scrollspy always selects the last nav,
need help D:
Victor Hernandez
@Theviajerock
Sep 14 2015 03:10
I am from Colombia, south America.
DJ Runas
@djrunas
Sep 14 2015 03:11
Welcome, @Theviajerock ! :)
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:11
south America is part of america
america is north america, central america and south america
:/
Mateja Trifunovski
@Matko95
Sep 14 2015 03:11
don't feed the troll :D
CamperBot
@camperbot
Sep 14 2015 03:11
:trollface: troll problems? notify admins here
DJ Runas
@djrunas
Sep 14 2015 03:11
It’s not part of North America though.
Kappa
Oh, this isn’t Twitch….
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:11
lol
Victor Hernandez
@Theviajerock
Sep 14 2015 03:11
Thanks @djrunas :D
CamperBot
@camperbot
Sep 14 2015 03:11
theviajerock sends brownie points to @djrunas :sparkles: :thumbsup: :sparkles:
:star: 182 | @djrunas | http://www.freecodecamp.com/djrunas
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:11
nope, it isnt
Victor Hernandez
@Theviajerock
Sep 14 2015 03:11
Jeje @carmelo12341 Yes...
DJ Runas
@djrunas
Sep 14 2015 03:11
You having trouble though, @carmelo12341 ?
Rex Schrader
@SaintPeter
Sep 14 2015 03:11
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:12
yes
Victor Hernandez
@Theviajerock
Sep 14 2015 03:12
But the people of United States say "America" to his country...
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:12
enter the codepen, it doesnt work in gitter
Victor Hernandez
@Theviajerock
Sep 14 2015 03:12
Because its called "United states of America"...
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:12
soy de peru :P
BaleBergaLaBida
Victor Hernandez
@Theviajerock
Sep 14 2015 03:12
Jajaja
DJ Runas
@djrunas
Sep 14 2015 03:12
Ah, Scrollspy.
chicachicamji
@chicachicamji
Sep 14 2015 03:13
does anybody know why "arguments.slice()" isn't a function?
DJ Runas
@djrunas
Sep 14 2015 03:13
Not too familiar with that yet as I’m still on the algorithms lol
Good luck!
Rex Schrader
@SaintPeter
Sep 14 2015 03:13
@chicachicamji Because arguments is not an array - it's an "array like object"
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:13
scrollspy is from bootstrap :/
Rex Schrader
@SaintPeter
Sep 14 2015 03:13
wiki js arguments
CamperBot
@camperbot
Sep 14 2015 03:13

:point_right: js arguments [wiki]

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

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

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

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

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

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

Mateja Trifunovski
@Matko95
Sep 14 2015 03:13
@carmelo12341 arguments[0].slice(); could work
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:13
wat
Rory Smith
@alanbuchanan
Sep 14 2015 03:14
@chicachicamji this should explain
Victor Hernandez
@Theviajerock
Sep 14 2015 03:15
@carmelo12341 Your portfolio exercise is great
Carlos Toro Vera
@carmelo12341
Sep 14 2015 03:16
still trying to fix that prob with scrollspy
F*ck you scrollspy
Anusha Suresh
@anushasuresh89
Sep 14 2015 03:16
@SaintPeter I used regex /w as there are other cases like "A man, a plan, a canal. Panama".. the code has to satisfy all the conditions mentioned.. the case 0_0 (: /-\ :) 0-0 should fail anyway..
Victor Hernandez
@Theviajerock
Sep 14 2015 03:17
I don't know how to do that "Parallax" style when i do the scroll.
Rory Smith
@alanbuchanan
Sep 14 2015 03:17
@anushasuresh89 if you're left with every non-word character removed, it actually is a palindrome (technically)
Rex Schrader
@SaintPeter
Sep 14 2015 03:17
@Theviajerock Make your scroll speed a multiple of the actual scroll speed
Victor Hernandez
@Theviajerock
Sep 14 2015 03:19
Thanks a lot @SaintPeter : D
CamperBot
@camperbot
Sep 14 2015 03:19
theviajerock sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: theviajerock already gave saintpeter points
Victor Hernandez
@Theviajerock
Sep 14 2015 03:19
i will check.
Anusha Suresh
@anushasuresh89
Sep 14 2015 03:19
@alanbuchanan I tried with the non-word character.. /W.. still not a palindrome..
Rex Schrader
@SaintPeter
Sep 14 2015 03:20
@anushasuresh89 Remember that /\W/ == /[^a-zA-Z0-9_]/ - Note the underscore, that's important to passing the last test case.
@anushasuresh89 You need to include the underscore in a character class with \W
Anusha Suresh
@anushasuresh89
Sep 14 2015 03:20
thanks, I ll try that
CamperBot
@camperbot
Sep 14 2015 03:20
if you want to thank someone, put an @ before their name!
Anusha Suresh
@anushasuresh89
Sep 14 2015 03:21
@SaintPeter Thanks, I ll try that
CamperBot
@camperbot
Sep 14 2015 03:21
anushasuresh89 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 603 | @saintpeter | http://www.freecodecamp.com/saintpeter
DJ Runas
@djrunas
Sep 14 2015 03:42
Let us know how it works out, @anushasuresh89 !
Oh, that was forever ago.
Never mind.
Alexander Schuneman
@AxSch
Sep 14 2015 03:54
Anyone on/done "Waypoint: Manipulate Arrays With pop”? My code just doesn’t seem to work
Jeremy Gorniak
@Gornstats
Sep 14 2015 03:57
@AxSch can you paste your code in here?
use ```
Alexander Schuneman
@AxSch
Sep 14 2015 03:57
This message was deleted
@Gornstats var myArray = ["John", 23, ["cat", 2]]; // Only change code below this line. var myArray.pop(); var removed = myArray.pop(); // This should be ["cat", 2] and myArray should now be ["John", 23]
Mikhail Evdokimov
@evdokimovm
Sep 14 2015 04:00
In project JavaScript Slot Machine in CSS i see flex: 1 0 auto;. what it does? which makes the option auto I understand but i not understans what is 1 and 0
Alexander Schuneman
@AxSch
Sep 14 2015 04:00
1 and 0 will probably mean true or false
Mikhail Evdokimov
@evdokimovm
Sep 14 2015 04:01
true and false in CSS ?
@AxSch
Alexander Schuneman
@AxSch
Sep 14 2015 04:02
nevermind it could have something to do with this
Mikhail Evdokimov
@evdokimovm
Sep 14 2015 04:02
img
hope that helps @evdokimovm :)
chicachicamji
@chicachicamji
Sep 14 2015 04:07
bonfire destroyer
CamperBot
@camperbot
Sep 14 2015 04:07
Sorry, can't find a bonfire called destroyer. [ Check the map? ]
chicachicamji
@chicachicamji
Sep 14 2015 04:07
bonfire seek and destroy
CamperBot
@camperbot
Sep 14 2015 04:07

: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

chicachicamji
@chicachicamji
Sep 14 2015 04:07
hint
CamperBot
@camperbot
Sep 14 2015 04:07
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Alexander Schuneman
@AxSch
Sep 14 2015 04:13
This message was deleted
Pratik Ratnaparkhi
@pratikr1593
Sep 14 2015 04:20
<script>
  $(document).ready(function() {
    $("button").addClass("animated bounce");
  });
</script>

<!-- You shouldn't need to modify code below this line -->

<div class="container-fluid">
  <h3 class="text-primary text-center">jQuery Playground</h3>
  <div class="row">
    <div class="col-xs-6">
      <h4>#left-well</h4>
      <div class="well"  id="left-well">
        <button class="btn btn-default target" id="target1">#target1</button>
        <button class="btn btn-default target" id="target2">#target2</button>
        <button class="btn btn-default target" id="target3">#target3</button>
      </div>
    </div>
    <div class="col-xs-6">
      <h4>#right-well</h4>
      <div class="well" id="right-well">
        <button class="btn btn-default target" id="target4">#target4</button>
        <button class="btn btn-default target" id="target5">#target5</button>
        <button class="btn btn-default target" id="target6">#target6</button>
      </div>
    </div>
  </div>
</div>
document ready function: $(".text-primary").addClass("animated shake");
where I am suppose to put this code?
anyone?
DJ
@qualitymanifest
Sep 14 2015 04:26
in the script portion. you've already got document ready up there so just
$(".text-primary").addClass("animated shake");
Anusha Suresh
@anushasuresh89
Sep 14 2015 04:48
@djrunas actually i am still stuck.. trying more suggestions.. trying to read up other sources for a better understanding of regex.. maybe that'll help..
Jesse
@jctm30
Sep 14 2015 04:49
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments);
  args.splice(0,1);
  return arr.filter(function(element) {
    return args.indexOf(element) === -1;
  });
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
hi guys, i need some help. i have the solution to seek and destroy but I need some further explanation on the "element" portion. How did they use "element" when its not even defined?
Matt Yamamoto
@MattYamamoto
Sep 14 2015 04:50
@jctm30 elements is being defined as a parameter for the function
codedestitute
@codedestitute
Sep 14 2015 04:53
how does the return line at the end return the value? i am confused by the check against -1
DTing
@dting
Sep 14 2015 04:53
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments, 1);
  return arr.filter(function(element) { // element is the function parameter
    return args.indexOf(element) === -1;
  });
}
Array.indexOf will return -1 if the element is not found in the array
so the destroyer function is returning the result of filtering the arr by checking if each element is in arr is in the args array. The args array is created by slicing the arguments object starting at index 1.
codedestitute
@codedestitute
Sep 14 2015 04:56
okay so it self iterated through the args array and if it isnt in the arr then it doesnt get added to the new filtered array?
that makes sense thank you
CamperBot
@camperbot
Sep 14 2015 04:56
if you want to thank someone, put an @ before their name!
DTing
@dting
Sep 14 2015 04:57
almost. it iterates through arr and checks if the elements of arr are in args
codedestitute
@codedestitute
Sep 14 2015 04:57
thank you @camperbot for helping me to thank @dting
CamperBot
@camperbot
Sep 14 2015 04:57
codedestitute sends brownie points to @camperbot and @dting :sparkles: :thumbsup: :sparkles:
:star: 213 | @camperbot | http://www.freecodecamp.com/camperbot
:star: 1164 | @dting | http://www.freecodecamp.com/dting
codedestitute
@codedestitute
Sep 14 2015 04:57
ok so its iterating both though in this case
DTing
@dting
Sep 14 2015 04:57
ya.
codedestitute
@codedestitute
Sep 14 2015 04:58
cause i remember the previous section with the filter just used one value to be filtered so i wasnt sure if it would go through a loop on its own i was trying to write my own internal loop and it was messy
DTing
@dting
Sep 14 2015 05:00
you are essentially replacing loop with a function of the Array class
Jesse
@jctm30
Sep 14 2015 05:00
@dting thanks
CamperBot
@camperbot
Sep 14 2015 05:00
jctm30 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1165 | @dting | http://www.freecodecamp.com/dting
codedestitute
@codedestitute
Sep 14 2015 05:02
man thats one classy language
DTing
@dting
Sep 14 2015 05:02
The indexOf can be written with a loop also:
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments, 1);
  return arr.filter(function(element) { // element is the function parameter
    for (var i = 0; i < args.length; i++) {
      if (args[i] === element) {
        return false;
      }
    }
    return true;
  });
}
codedestitute
@codedestitute
Sep 14 2015 05:02
youd never get that in c++
Jesse
@jctm30
Sep 14 2015 05:03
@dting dang i don't fully understand the logic hmmm
codedestitute
@codedestitute
Sep 14 2015 05:05
oh wow see thats what i was trying to do but i thought you had to return the value not a true or false
DTing
@dting
Sep 14 2015 05:05
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments, 1);
  function notInArgsFilter(element) {
    for (var i = 0; i < args.length; i++) {
      if (args[i] === element) {
        return false;
      }
    }
    return true;
  }
  return arr.filter(notInArgsFilter);
}
its always a good idea to read the docs to see how functions you are using work
codedestitute
@codedestitute
Sep 14 2015 05:06
ahaha yeah i totally skipped the callback part that states that very clearly
wow i failed
Susan Zell
@susanzell
Sep 14 2015 05:12
i was just stuck on the search and destroy for so long, i'm on the next and can't even read the instructions, my brain is destroyed!
for some reason i thought i'd need to use the thisArg to make the filtering function pull in arguments[i], cause i was trying to call the function within my for loop
i like @dting's answer better than the codebot's spoiler answer :)
codedestitute
@codedestitute
Sep 14 2015 05:21
does array indexOf function not return the first index in which it finds the argument?
Victor
@Evaderei
Sep 14 2015 05:26
@dting thanks, i glossed over that var args = array.proto bit
CamperBot
@camperbot
Sep 14 2015 05:26
evaderei sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1166 | @dting | http://www.freecodecamp.com/dting
Cong Li
@lee5214
Sep 14 2015 05:40

hi guys, I got a /problem in Bonfire: Sum All Odd Fibonacci Numbers/ that I wish if someone could help me

function sumFibs(num) {
  var addup=0;
  var rec = function(currentNum, nextNum, fibN) {
        if (fibN == 0) {
            return addup;
        } else if(currentNum%2 !== 0 && currentNum<=num){
            addup += currentNum;
            console.log("current: " + currentNum+"  addup:" + addup);   
          }return rec(nextNum, currentNum+nextNum, fibN-1);

        }
  return rec(1, 1, num);
}
sumFibs(1000);

I finished this and I tried all the numbers in test cases, it retuns an error called "Maximum call stack size exceeded" when the number is too large, like 75024.
But during debug, it actually shows the correct answer in console. So I'm wondering if it's because there's a limit time for browser to call recursive function?

Cong Li
@lee5214
Sep 14 2015 05:46
damn,I just solved it 2 mins after I posted it lol.....
Ali-Haider5
@Ali-Haider5
Sep 14 2015 06:22
Need help anyone?
I need help anyone here who can help?
@ingeniumsolutiones thanks
CamperBot
@camperbot
Sep 14 2015 06:23
ali-haider5 sends brownie points to @ingeniumsolutiones :sparkles: :thumbsup: :sparkles:
:star: 174 | @ingeniumsolutiones | http://www.freecodecamp.com/ingeniumsolutiones
Ali-Haider5
@Ali-Haider5
Sep 14 2015 06:24
This message was deleted
Ali-Haider5
@Ali-Haider5
Sep 14 2015 06:54
This message was deleted
This message was deleted
This message was deleted
This message was deleted
Ali-Haider5
@Ali-Haider5
Sep 14 2015 06:59
This message was deleted
Ali-Haider5
@Ali-Haider5
Sep 14 2015 07:06
Hi
JamesdashTaylor
@JamesdashTaylor
Sep 14 2015 07:11

On http://www.freecodecamp.com/challenges/waypoint-make-object-properties-private, stuck on making myBike.getSpeed publicly accessible. Have changed this.speed = 100;' to 'Bike.speed = 100;, now what?

`
//Let's create an object with a two functions. One attached as a property and one not.
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};

var Bike = function() {
// Only change code below this line.
Bike.speed = 100;
function addUnit(value) {
return value + "KM/H";
}

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

};

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

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

Oops - not sure why the markdown didn't work
Athul Ganesh
@athul777
Sep 14 2015 07:14
hey guys, I had a question on the quote machine zipline regarding the twitter button. I managed to make a static twitter button, but when I tried to make the twitter button dynamic and automatically display the quote's text while tweeting, I encountered some strange errors.
here is the html:
<html>
    <head>

        <title>
            Random Quote Machine
        </title>

        <link rel = 'stylesheet' href = 'Help.css'>
        <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js'></script>
        <script type='text/javascript' src='Help.js'></script>

    </head>
    <body>
        <div class = 'heading-area'>
            <h1 class = 'main-heading'>Athul's Random Quote Machine</h1>
        </div>
        <div class = 'paragraph-area'>
            <p class = 'main-paragraph'>These are some quotes from the Forbes list of inspirational quotes. I hope reading some of these quotes gives you inspiration. Click the button to randomly view any of these quotes.</p>
        </div>
        <div class = 'button-area'>
            <button class = 'new-quote-button'>New Quote</button>
        </div>
        <div class = 'quote-area'>
            <div class = 'quoteContainer'>
                <p id = 'quote'></p>
                <p id = 'author'></p>
                <div id = 'twitterContainer'></div>
            </div>
        </div>

    </body>

    <script>
    window.twttr = (function(d, s, id) {
        var t, js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s);
        js.id = id;
        js.src = "https://platform.twitter.com/widgets.js";
        fjs.parentNode.insertBefore(js, fjs);
        return window.twttr || (t = {
            _e: [],
            ready: function(f) {
                t._e.push(f)
            }
        });
    }(document, "script", "twitter-wjs"));
</script>

</html>
javascript:
This message was deleted
$(document).ready(function () {
    var str1;
    var strId = '';
    var testStr;
    var clickCounter = 0;
    function newQuote () {
        var quoteArr = ["Whatever the mind of man can conceive and believe, it can achieve.", "Strive not to be a success, but rather to be of value.", "Two roads diverged in a wood, and I - I took the one less traveled by, And that has made all the difference.", "I attribute my success to this: I never gave or took any excuse.", "You miss 100% of the shots you don't take.", "I've missed more than 9000 shots in my career. I've lost almost 300 games. 26 times I've been trusted to take the game winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed.", "The most difficult thing is the decision to act, the rest is merely tenacity.", "Every strike brings me closer to the next home run.", "Definiteness of purpose is the starting point of all achievement.", "Life isn't about getting and having, it's about giving and being.", "Life is what happens to you while you're busy making other plans.", "We become what we think about.", "Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do, so throw off the bowlines, sail away from safe harbor, catch the trade winds in your sails.  Explore, Dream, Discover.", "Life is 10% what happens to me and 90% of how I react to it.", "The most common way people give up their power is by thinking they don't have any.", "The mind is everything. What you think you become.", "The best time to plant a tree was 20 years ago. The second best time is now.", "An unexamined life is not worth living.", "Eighty percent of success is showing up.", "Your time is limited, so don't waste it living someone else's life.", "Every child is an artist.  The problem is how to remain an artist once he grows up.", "You can never cross the ocean until you have the courage to lose sight of the shore.", "I've learned that people will forget what you said, people will forget what you did, but people will never forget how you made them feel.", "Either you run the day, or the day runs you.", "Whether you think you can or you think you can't, you're right.", "The two most important days in your life are the day you are born and the day you find out why.", "Whatever you can do, or dream you can, begin it.  Boldness has genius, power and magic in it.", "The best revenge is massive success.", "People often say that motivation doesn't last. Well, neither does bathing.  That's why we recommend it daily.", "Life shrinks or expands in proportion to one's courage."];
        var authorArr = ['Napoleon Hill', 'Albert Einstein', 'Robert Frost', 'Florence Nightingale', 'Wayne Gretzky', 'Michael Jordan', 'Amelia Earhart', 'Babe Ruth', 'W. Clement Stone', 'Kevin Kruse', 'John Lennon', 'Earl Nightingale', 'Mark Twain', 'Charles Swindoll', 'Alice Walker', 'Buddha', 'Chinese Proverb', 'Socrates', 'Woody Allen', 'Steve Jobs', 'Pablo Picasso', 'Christopher Columbus', 'Maya Angelou', 'Jim Rohn', 'Henry Ford', 'Mark Twain', 'Johann Wolfgang von Goethe', 'Frank Sinatra', 'Zig Ziglar', 'Anais Nin'];

        var randomSelector = Math.floor(Math.random()*quoteArr.length);
        str1 = quoteArr[randomSelector];
        $('#quote').html(quoteArr[randomSelector]);
        $('#author').html(authorArr[randomSelector]);
        alert('newQuote');
    }

    newQuote();
    newTwitterButton();


    function newTwitterButton () {
        var newTweet = document.createElement('a');
        newTweet.setAttribute('href', 'https://twitter.com/share');
        newTweet.setAttribute('class', 'twitter-share-button');
        newTweet.setAttribute('id', 'twitterButton');
        newTweet.setAttribute("data-text", str1);
        newTweet.setAttribute("data-count", "none");
        tweetdiv = document.getElementById('twitterContainer');
        tweetdiv.appendChild(newTweet);
        twttr.widgets.load();
        alert('TwitterButton');
    }
javascript contd:
This message was deleted
function deleteTweet () {
        var twitterDelete = document.getElementById('twitterContainer');
        if (twitterDelete != null) {
            twitterDelete.parentNode.removeChild(twitterDelete);
            alert('deleteTweet');
        }
    }

    $('.new-quote-button').click(function () {
        clickCounter = clickCounter + 1;
        newQuote();
        newTwitterButton();
        alert('Onclick');
        if (clickCounter >= 1) {
            deleteTweet();
        }
    });
});
since the twitter API doesn't support dynamically changing the data text for each button, I looked up a way where you have to keep adding and deleting buttons
Athul Ganesh
@athul777
Sep 14 2015 07:19
the problem is that this deletes and never creates a new button
can anyone try and help me figure out what the problem is
Ali-Haider5
@Ali-Haider5
Sep 14 2015 07:28

need Help:
```// var ourDecimal = 5.7;
// Create a number with a decimal point here called myDecimal

var myDecimal = 21.3

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(){if(typeof(myDecimal) !== "undefined"){return myDecimal;}})();```

need help on this
// var ourDecimal = 5.7;
// Create a number with a decimal point here called myDecimal

var myDecimal = 21.3

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(){if(typeof(myDecimal) !== "undefined"){return myDecimal;}})();
marzelin
@marzelin
Sep 14 2015 07:29
@Ali-Haider5 add ; at the end of the line
Ali-Haider5
@Ali-Haider5
Sep 14 2015 07:30
oh
thanks @marzelin
CamperBot
@camperbot
Sep 14 2015 07:30
ali-haider5 sends brownie points to @marzelin :sparkles: :thumbsup: :sparkles:
:star: 196 | @marzelin | http://www.freecodecamp.com/marzelin
JamesdashTaylor
@JamesdashTaylor
Sep 14 2015 07:31
@JamesdashTaylor worked it out
Ali-Haider5
@Ali-Haider5
Sep 14 2015 07:39
Help:
CamperBot
@camperbot
Sep 14 2015 07:39

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

Basic Commands:

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

:speech_balloon: meet CamperBot in this room!

:pencil: read more about camperbot on the FCC Wiki

Ali-Haider5
@Ali-Haider5
Sep 14 2015 07:39
find Waypoint: Modify Array Data With Indexes
CamperBot
@camperbot
Sep 14 2015 07:39

find waypoint modify array data with indexes

:zero: waypoint modify array data with indexes

Dorin Cretu
@cretudorin
Sep 14 2015 07:45
find jQuery
Mirza Ibrahimovic
@MirzaI
Sep 14 2015 08:17
This message was deleted
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:28
Can someone tell me why chaining .replace here isn't working?
else if ((str.indexOf("<") > -1) && (str.indexOf(">") > -1)){
      newstr = str.replace(/</g,'&lt;').replace(/>/g,'&gt;');
      console.log(newstr);
  }
It comes out: '<>'
oops
```
'&lt;>'
tva10
@tva10
Sep 14 2015 08:34
@TheHighPriestess may be you need '\' before '>'. like this
@TheHighPriestess like this replace(/>/g, '&gt');
Dealga McArdle
@zeffii
Sep 14 2015 08:35
debug it in a codepen window @TheHighPriestess
var newstr = '';
var str = '<some tag="claa"></some tag>'

newstr = str.replace(/</g,'&lt;').replace(/>/g,'&gt;');
console.log(newstr);

// &lt;some tag="claa"&gt;&lt;/some tag&gt;
tva10
@tva10
Sep 14 2015 08:36
@TheHighPriestess
.replace(/\>/g,'&gt;')
Dealga McArdle
@zeffii
Sep 14 2015 08:36
make sure the body of the statement does what you expect, first with a known input
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:36
ok...let me try this out
Costas Chaitas
@CostasChaitas
Sep 14 2015 08:36
anybody can help me with the Waypoint: Manage Packages with NPM
?
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:37
@datFox that didn't work...
it still only outputs the &lt
it's not picking up the second .replace
Dealga McArdle
@zeffii
Sep 14 2015 08:38
the chained string seems ok actually, it may be the if statement
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:39
yeah...from what I'm reading...it's OK to chain .replace like this
Dealga McArdle
@zeffii
Sep 14 2015 08:39
(because without the if statement, and with known input as shown above.. it does work correctly )
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:40
but...the IF statement looks OK to me.
Dealga McArdle
@zeffii
Sep 14 2015 08:40
may also help to console.log(str) as the first thing after the if statement, before doing the replace.
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:40
isn't that how you would check if both arrow are there?
Dealga McArdle
@zeffii
Sep 14 2015 08:40
to see what is it.. if there are spaces..
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:40
yeah...good idea
Dealga McArdle
@zeffii
Sep 14 2015 08:41
never trust input :)
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:42
it doesn't even make it to the console log
interesting
now i'm completely confused
Dealga McArdle
@zeffii
Sep 14 2015 08:42
yeah. so the str must be gobbled up by one of your other if statements
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:43
but....it does output &lt though
Dealga McArdle
@zeffii
Sep 14 2015 08:43
or stick in a final 'else` to see if it reaches that
without seeing all your code I can't make an informed suggestion
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:44
hold on...I will paste it all
Dealga McArdle
@zeffii
Sep 14 2015 08:44
but maybe you know enough for now..
noo... try yourself first
you know more now than you did a few minutes ago
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:44
function convert(str) {


  if (str.indexOf('&') > -1){
      var newstr = str.replace(/&/g,'&amp;');
      console.log(newstr);
  }
  else if (str.indexOf('<') > -1){
      newstr = str.replace(/</g,'&lt;');
      console.log(newstr);
  }
  else if (str.indexOf('>') > -1){
      newstr = str.replace(/>/g,'&gt;');
      console.log(newstr);
  }
  else if (str.indexOf('"') > -1){
      newstr = str.replace(/"/g,'&quot;');
      console.log(newstr);
  }
  else if (str.indexOf("'") > -1){
      newstr = str.replace(/'/g,'&apos;');
      console.log(newstr);
  }
  else if ((str.indexOf("<") > -1) && (str.indexOf(">") > -1)){
      console.log(str);
      newstr = str.replace(/</g,'&lt;').replace(/\>/g,'&gt;');
      console.log(newstr);
  }
  else {
      return str;
  }


  return newstr;
}

convert('Dolce & Gabbana');
convert('Hamburgers < Pizza < Tacos');
convert('Sixty > twelve');
convert('Stuff in "quotation marks"')
convert("Schindler's List");
convert('<>');
convert('abc');
Dealga McArdle
@zeffii
Sep 14 2015 08:46
it gets gobbled by your first else-if
move the more specific else if up to the top
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:46
right
@zeffii thank you. good idea
CamperBot
@camperbot
Sep 14 2015 08:46
thehighpriestess sends brownie points to @zeffii :sparkles: :thumbsup: :sparkles:
:star: 341 | @zeffii | http://www.freecodecamp.com/zeffii
Dealga McArdle
@zeffii
Sep 14 2015 08:46
reason about why
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:47
@datFox thank you for helping as well
CamperBot
@camperbot
Sep 14 2015 08:47
thehighpriestess sends brownie points to @datfox :sparkles: :thumbsup: :sparkles:
:star: 187 | @datfox | http://www.freecodecamp.com/datfox
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:47
@zeffii Yeah....because it DOES contain that. I'm a pro at making this particular error
Luis Felipe López G.
@luishendrix92
Sep 14 2015 08:48
@TheHighPriestess Yeah, and your approach wouldn't work if a string was something like "I like turtles & drugs <because that's why>"
Dealga McArdle
@zeffii
Sep 14 2015 08:48
then become a pro at spotting that error. @TheHighPriestess
Luis Felipe López G.
@luishendrix92
Sep 14 2015 08:48
It would only replace the & but not the other characters.
Jack Demynn
@infectiouscode
Sep 14 2015 08:49
Hey, I'm a little confused on these arrays and variables part of Java, can someone explain how I create a variable and get it to equal the first value of myArray please
//var ourArray = [1,2,3];
//var ourData = ourArray[0]; // equals 1
var myDate = []
var myArray = [1,2,3];
// Only change code below this line.


// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
if(typeof(myArray) !== "undefined" && typeof(myData) !== "undefined"){(function(y,z){return 'myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z);})(myArray, myData);}
Elizabeth Hatleli
@TheHighPriestess
Sep 14 2015 08:49
@luishendrix92 well....I'm going on what the Bonfire is asking for.
Dealga McArdle
@zeffii
Sep 14 2015 08:50
@infectiouscode Javascript, not java :)
Jack Demynn
@infectiouscode
Sep 14 2015 08:50
That too ;) @zeffii
Dealga McArdle
@zeffii
Sep 14 2015 08:51
the answer is right there, in the code you posted
in the first two lines even.
Jack Demynn
@infectiouscode
Sep 14 2015 08:51
I know' its there in the comments
but I dont understand why im doing it
i was shit at math
Luis Felipe López G.
@luishendrix92
Sep 14 2015 08:52
@infectiouscode Array elements (that can also be arrays themselves making the array bi, tri, cuatri, N-DIMENSIONAL) have indices, identifiers, from 0 to n (equivalent to the length of the array minus one), you need to use square bracket notation in front of the array variable name
Jack Demynn
@infectiouscode
Sep 14 2015 08:53
Like, in the code why does ourArrays value = 0?
Dealga McArdle
@zeffii
Sep 14 2015 08:53
that's not a value, it's an index
like a postcode
first house on the street has postcode 0
Jack Demynn
@infectiouscode
Sep 14 2015 08:53
So why was it given that index?
Dealga McArdle
@zeffii
Sep 14 2015 08:54
first element in an array has index 0
Samantha Maturen
@slmaturen
Sep 14 2015 08:54
Yeah, for some reason, the items in an array are numbered starting from 0
So when you say myArray[0], you are referring to the first item in your array
Luis Felipe López G.
@luishendrix92
Sep 14 2015 08:55
["dogs", 56, "cats", {prop: "val"}, true]
the index 0 holds "dogs"
the index 1 holds 56
and so on, so, if my array was stored inside a variable like var myArray = ["dogs", 56, "cats", {prop: "val"}, true]; and I needed to access "cats", I'd have to type in myArray[2]
Dealga McArdle
@zeffii
Sep 14 2015 08:55
var mySuperArray  = [20, 30, 40];
var firstValueOfSuperArray = mySuperArray[0]
@infectiouscode don't worry too much about why the indexing starts at 0, it's a convention - with mathematical benefits. There are programming languages that index from 1 onwards
Jack Demynn
@infectiouscode
Sep 14 2015 08:56
I seee...... So essentially it's saying to find the first index you need to type in the name of the variable you need the number from (myArray) then what position in the string you need to get the info from?
Dealga McArdle
@zeffii
Sep 14 2015 08:57
position in the Array.. or String.. yes :)
Samantha Maturen
@slmaturen
Sep 14 2015 08:57
yep yep :thumbsup:
Jack Demynn
@infectiouscode
Sep 14 2015 08:57
and then you write what is in the position?
Dealga McArdle
@zeffii
Sep 14 2015 08:57
try it
Jack Demynn
@infectiouscode
Sep 14 2015 08:57
okie dokily
Luis Felipe López G.
@luishendrix92
Sep 14 2015 08:57
The JavaScript engine will replace myArray[0] with the value stored inside the array
it's like telling a robot to fetch you the 1st slice of bread in the array of bread slices
Dealga McArdle
@zeffii
Sep 14 2015 08:58
(at that index)
Luis Felipe López G.
@luishendrix92
Sep 14 2015 08:58
hope he doesn't eat the bread
Jack Demynn
@infectiouscode
Sep 14 2015 08:59
Yayy did it,
thanks @zeffii @luishendrix92 @samchalle
CamperBot
@camperbot
Sep 14 2015 08:59
infectiouscode sends brownie points to @zeffii and @luishendrix92 and @samchalle :sparkles: :thumbsup: :sparkles:
:star: 254 | @samchalle | http://www.freecodecamp.com/samchalle
:star: 342 | @zeffii | http://www.freecodecamp.com/zeffii
:star: 345 | @luishendrix92 | http://www.freecodecamp.com/luishendrix92
Samantha Maturen
@slmaturen
Sep 14 2015 08:59
@infectiouscode :clap:
Dealga McArdle
@zeffii
Sep 14 2015 09:00
Do the instructions make a bit more sense now you understand it @infectiouscode ?
Jack Demynn
@infectiouscode
Sep 14 2015 09:00
Yeah, I think sometime's I just need it explained a bit more to make sure I get what it means @zeffii
Little bit confused on this one though, It says I've done the first bit right. It asked me to modify the 0 inde to 3 and said I did it right but then below that said I should be using the correct index to modify it?
var ourArray = [1,2,3];
ourArray[1] = 3;
// ourArray[1] now equals [1,3,3].
var myArray = [3,2,3];
// Only change code below this line.


// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
if(typeof(myArray) !== "undefined"){(function(){return myArray;})();}
Luis Felipe López G.
@luishendrix92
Sep 14 2015 09:05
@infectiouscode Try not to get confused when you are in need of understanding stuff like:
var superArray = [[0],[1, "one"],[[[["hello"]]]]];
console.log(superArray[2][0][0][0][0]);
// --> "hello"
Jack Demynn
@infectiouscode
Sep 14 2015 09:06
Well I need help with the above, as I'm not at that stage yet.
It's confusing because it's all new
Luis Felipe López G.
@luishendrix92
Sep 14 2015 09:06
Oh well, you could use whateverArray[whateverIndex] = "Whatever Value"
Jack Demynn
@infectiouscode
Sep 14 2015 09:07
So I need to add the little position thing again, okay. Cheers luish
Luis Felipe López G.
@luishendrix92
Sep 14 2015 09:07
if the index has an element, it will replace it, if the index doesn't exist, it will create the element and if there are preceding indices, the engine will replace them with "undefined"
Jack Demynn
@infectiouscode
Sep 14 2015 09:08
Okay thanks
CamperBot
@camperbot
Sep 14 2015 09:08
if you want to thank someone, put an @ before their name!
Samantha Maturen
@slmaturen
Sep 14 2015 09:09
I'm not sure if the code showing in your message above is what you submitted @infectiouscode , but it says to modify the [0] index, but the 1 index is the one you modified
Jack Demynn
@infectiouscode
Sep 14 2015 09:09
No I modified the 0
it asked for the 0 index in the line of 1,2,3 i changed the 1 to a 3
Samantha Maturen
@slmaturen
Sep 14 2015 09:10
so you did myArray[0] = 3?
Elliott Maas
@elliottmaas
Sep 14 2015 09:11
can anyone help me figure out waypoint 133 (Use Conditional Logic with IfElse Statements)?
Omar
@oab00
Sep 14 2015 09:13

@infectiouscode
when you do this

var ourArray = [1,2,3];
ourArray[1] = 3;

it's actually modifying the 2 to 3
so the array becomes
[1,3,3]

1 is the index of second item in the array
arrays start counting at 0
Jack Demynn
@infectiouscode
Sep 14 2015 09:14
well it worked and let me through
the our array was pre done, thats not what I did
it was an example
I was doing my array
but its all fine now im on the next one :)
Samantha Maturen
@slmaturen
Sep 14 2015 09:15
Oh, alright. I thought you said you got an error.
If you passed, then it's fine
Omar
@oab00
Sep 14 2015 09:15
well congratz :)
Jack Demynn
@infectiouscode
Sep 14 2015 09:15
I did, but it's because I didn't add a line of code that I should have
Luis Felipe López G.
@luishendrix92
Sep 14 2015 09:16

Ok, just remember that:

0 - 1 - 2 - 3 - 4 - 5 ... n

And that the last item of an array is the length of the array - 1 and the first one's 0
you're good to go with that

Some string methods accept negative indices lol
Dealga McArdle
@zeffii
Sep 14 2015 09:16
like a baby is zero years old for the first year of life :)
Jack Demynn
@infectiouscode
Sep 14 2015 09:17
:P
nice analogy
Arsalan Sabir
@aayanqazi
Sep 14 2015 09:17
Can any one help me
?
Jack Demynn
@infectiouscode
Sep 14 2015 09:18
Might be a lot of help needed to me in this javascript section haha; im on the pop section now? I was wondering how you pop stuff?

Samantha Maturen
@slmaturen
Sep 14 2015 09:18
You need to tell us a bit about your problem first :p @aayanqazi
Jack Demynn
@infectiouscode
Sep 14 2015 09:18
//var numbers = [1,2,3];
//console.log(numbers); // logs [1,2,3]
//var removed = numbers.pop();
//console.log(numbers); // logs [1,2]
//console.log(removed); // logs 3

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

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

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z);})(myArray, removed);
it need to be popped so its only john and 23 i think
Samantha Maturen
@slmaturen
Sep 14 2015 09:19
@infectiouscode Did you read the comments at the top of the code you just pasted?
Jack Demynn
@infectiouscode
Sep 14 2015 09:19
Yeah but they dont make sense cause I havent learn about console.log yet
Arsalan Sabir
@aayanqazi
Sep 14 2015 09:20
how to change a properties in cSs when the div element inside a div .....
Dealga McArdle
@zeffii
Sep 14 2015 09:20
This message was deleted
Arsalan Sabir
@aayanqazi
Sep 14 2015 09:20

I want to change the properties of Arsalan ... But This is Not Working :/

http://codepen.io/aayanqazi/pen/KddYRx/

Samantha Maturen
@slmaturen
Sep 14 2015 09:20
@zeffii I don't know if that info is going to help him at this point.. lol
Jack Demynn
@infectiouscode
Sep 14 2015 09:20
Yeah that made no sense haha
Samantha Maturen
@slmaturen
Sep 14 2015 09:21
@infectiouscode That's not command line, that's just what the code would look like in a basic text editor. The // before a line of text turns it into a comment, so that it's not read as code in the browser
guxxi11
@guxxi11
Sep 14 2015 09:22
Hi! I am having trouble with declaring string variables in javascript. I have put this in but it is not working: var myName = "Amy Kim";
var firstName = "Amy";
var lastName = "Kim";
I also tried just var firstName and var lastName without the var myName line
Jack Demynn
@infectiouscode
Sep 14 2015 09:22
I know that, but all of the console.log text it put in doestn make sense to me
Samantha Maturen
@slmaturen
Sep 14 2015 09:22
first they create and array "numbers" with the values of [1, 2, 3]
Dealga McArdle
@zeffii
Sep 14 2015 09:22
ok @infectiouscode -- arrays can be indexed negatively too.. one day that will make sense :)
Jack Demynn
@infectiouscode
Sep 14 2015 09:22
@aayanqazi you havent added an id for your arsalan thing in your CSS
Samantha Maturen
@slmaturen
Sep 14 2015 09:22
Then they remove the very last index that has the value of 3 by using numbers.pop();
Jack Demynn
@infectiouscode
Sep 14 2015 09:23
But where in the code is pop place?
Samantha Maturen
@slmaturen
Sep 14 2015 09:24
Look at the top comment and see what var removed is set to in the example
In the gray text I mean
And see how you can change the "var removed" that's in color to match that
guxxi11
@guxxi11
Sep 14 2015 09:25
Does anyone see what I am doing wrong here? Example says: // name = "Alan Turing";
// var firstName = "Alan";
// var lastName = "Turing";
I did:
name = "Amy Kim";
var firstName = "Amy";
var lastName = "Kim";
Jack Demynn
@infectiouscode
Sep 14 2015 09:25
Still no idea how to do it, nothing seems to work
Samantha Maturen
@slmaturen
Sep 14 2015 09:26
The code in the example is var removed = numbers.pop();
The code you need to alter is var removed = myArray;
Elliott Maas
@elliottmaas
Sep 14 2015 09:27
This is what I tried to do for Waypoint 133. Something is wrong with it. Can someone tell me what?
if (flip == 0) {
return heads;
}
else (flip >0) {
return tails;
}
Jack Demynn
@infectiouscode
Sep 14 2015 09:27
ok one second
Aleksander Gębicki
@Takumar
Sep 14 2015 09:27
@guxxi11 you need to add var statement in your first line: var name = "Amy Kim";
guxxi11
@guxxi11
Sep 14 2015 09:27
@Takumar thanks!
CamperBot
@camperbot
Sep 14 2015 09:27
guxxi11 sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
Dealga McArdle
@zeffii
Sep 14 2015 09:27
@elliottmaas most likely == instead of ===
CamperBot
@camperbot
Sep 14 2015 09:28
:star: 318 | @takumar | http://www.freecodecamp.com/takumar
Samantha Maturen
@slmaturen
Sep 14 2015 09:28
@elliottmaas The else statement shouldn't have any condition in it
The else is just what runs when the if condition isn't met
Jack Demynn
@infectiouscode
Sep 14 2015 09:29
Still cant do it I have no idea what im doing wrong, and what to do
Javascript is so hard..
Aleksander Gębicki
@Takumar
Sep 14 2015 09:29
@elliottmaas if condition has other structure:
if (condition) {
}
else if (condition2) {
}
else {
}
Jack Demynn
@infectiouscode
Sep 14 2015 09:30
None of JS is making sense to me at all... html and css is really easy to learn JS is just too hard.
Samantha Maturen
@slmaturen
Sep 14 2015 09:30
@infectiouscode You literally just need to copy their example but change the variable name from numbers to myArray
Aleksander Gębicki
@Takumar
Sep 14 2015 09:30
@samchalle was faster :-)
Samantha Maturen
@slmaturen
Sep 14 2015 09:30
var removed = myArray; is missing something at the end of it
Luis Felipe López G.
@luishendrix92
Sep 14 2015 09:30
This message was deleted
Arsalan Sabir
@aayanqazi
Sep 14 2015 09:31

Thats the problem is it why Arsalan SAbir is not place in proper box ??

http://codepen.io/aayanqazi/pen/KddYRx/

Luis Felipe López G.
@luishendrix92
Sep 14 2015 09:31
Sorry for my bad writing but I feel like going to sleep and I don't function well at this hour of the day (2 am), so I'm off to bed guys, take care :)
Jack Demynn
@infectiouscode
Sep 14 2015 09:31
1) That image shows nothing, 2) I added what needed to go there but it wont register it, im really wanting to give up on JS.
Dealga McArdle
@zeffii
Sep 14 2015 09:31
@luishendrix92 good night!
Samantha Maturen
@slmaturen
Sep 14 2015 09:31
Don't give up :D
Jack Demynn
@infectiouscode
Sep 14 2015 09:32
I dont understand a single piece of JS
Samantha Maturen
@slmaturen
Sep 14 2015 09:32
Did you try var removed = myArray.pop();
Jack Demynn
@infectiouscode
Sep 14 2015 09:32
Yep tried it, didnt tick any boxes
Luis Felipe López G.
@luishendrix92
Sep 14 2015 09:32
This message was deleted
Samantha Maturen
@slmaturen
Sep 14 2015 09:32
I don't see how that's possible :(
Paste your code?
Arsalan Sabir
@aayanqazi
Sep 14 2015 09:33
??
Jack Demynn
@infectiouscode
Sep 14 2015 09:33
//var numbers = [1,2,3];
//console.log(numbers); // logs [1,2,3]
//var removed = numbers.pop();
//console.log(numbers); // logs [1,2]
//console.log(removed); // logs 3

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

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

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z);})(myArray, removed);
Samantha Maturen
@slmaturen
Sep 14 2015 09:34
oh
Peeravit Prapatrangsi
@goobeck
Sep 14 2015 09:35
var myArray = ["John", 23, ["cat", 2]];
Samantha Maturen
@slmaturen
Sep 14 2015 09:35
Yeah, you must have accidentally deleted the closing brace or something
no biggie
Happens to the best of us
:p
Jack Demynn
@infectiouscode
Sep 14 2015 09:36
What a douche... (Me not you) I still dont really understand why im doing what im doing in JS it doesnt really make any sense to me
Samantha Maturen
@slmaturen
Sep 14 2015 09:36
It'll click!
It takes time.
Jack Demynn
@infectiouscode
Sep 14 2015 09:36
I failed everything in highschool haha
especially maths
Samantha Maturen
@slmaturen
Sep 14 2015 09:37
I know FreeCodeCamp is supposed to be comprehensive, but it can help to check out some other resources sometimes too.
Jack Demynn
@infectiouscode
Sep 14 2015 09:37
yeah I spose
Dealga McArdle
@zeffii
Sep 14 2015 09:37
so did I - that's not going to stop you @infectiouscode
Samantha Maturen
@slmaturen
Sep 14 2015 09:37
Maybe check out the Codecademy.com JavaScript course
Andy Taylor
@theador0691
Sep 14 2015 09:37
@aayanqazi because it is too big for the width it looks like.
Samantha Maturen
@slmaturen
Sep 14 2015 09:38
Don't give up though - it really can take a lot of brute force to make the knowledge stick sometimes.
But you'll get it :)
Andy Taylor
@theador0691
Sep 14 2015 09:38
@aayanqazi if you change the width to something like width: 200px;
it comes out on one line
Elliott Maas
@elliottmaas
Sep 14 2015 09:38
@zeffii @samchalle I figured it out. Just needed to place quotes around the words "heads" and "tails". And all this time I thought I was fundamentally misunderstanding the underlying logic. Just silly quotes.
Jack Demynn
@infectiouscode
Sep 14 2015 09:39
I think i find it difficult cause i dont really have any friends that do any of the things I do so its not like i always have someone to chat about code with or maybe im just making excuses i dunno
Samantha Maturen
@slmaturen
Sep 14 2015 09:39
@elliottmaas Hahaha. Nice! Silly mistakes are sometimes the hardest to find. I always check now for missing semi-colons or quotes in my code when it's broken. 90% of the time it's something stupid like that.
Dealga McArdle
@zeffii
Sep 14 2015 09:40
@elliottmaas but you did write == instead of === and have a malformed if-else ...on top of that
Arsalan Sabir
@aayanqazi
Sep 14 2015 09:40
SolveD ;)
Samantha Maturen
@slmaturen
Sep 14 2015 09:40
@infectiouscode That's what we're all here for!
Jack Demynn
@infectiouscode
Sep 14 2015 09:41
I like this community, nice little place to talk to others :) @samchalle
Dealga McArdle
@zeffii
Sep 14 2015 09:42
learning to program .. is mostly difficult until you really get a hang of arrays/strings/flow control ...then most new things you come accross will fit somewhere in your mental framework of the language..
Jack Demynn
@infectiouscode
Sep 14 2015 09:43
Yeah I spose, it's just thoughing through all the difficult stuff i spose
Elliott Maas
@elliottmaas
Sep 14 2015 09:45
@zeffii I wiped it and started over, then added the quotes. So the code I posted was not the final code.
Dealga McArdle
@zeffii
Sep 14 2015 09:46
right, as long as you feel you know what the problem was :)
@elliottmaas in the end what did you submit?
Rahul
@RahulReddy75
Sep 14 2015 09:49
help Waypoint: Condense arrays with reduce
CamperBot
@camperbot
Sep 14 2015 09:49
no wiki entry for: waypoint condense arrays with reduce
:pencil: click here to create one now!after creating your page type update to reload it here
Elliott Maas
@elliottmaas
Sep 14 2015 09:58
@zeffii if (flip === 0) {
return "heads";
}
else {
return "tails";
}
Aleksander Gębicki
@Takumar
Sep 14 2015 09:59
@elliottmaas it seems ok. Do you still have any problem with this?
MrZappy
@MrZappy
Sep 14 2015 10:04
Sup guys
Raven Fuentes
@RavenFuentes
Sep 14 2015 10:05
guys help
Roy
@CruelCoin
Sep 14 2015 10:05
@RavenFuentes Aye? Whats up?
Raven Fuentes
@RavenFuentes
Sep 14 2015 10:06
@CruelCoin im stuck

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

palindrome("eye");

Vatsala Swaroop
@smarshy
Sep 14 2015 10:07
Hey need help with 'Bonfire: Check for Palindromes'
Can't get the removing punctuations part to work
CamperBot
@camperbot
Sep 14 2015 10:07
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Roy
@CruelCoin
Sep 14 2015 10:07
Bonfire: Check for Palindromes
CamperBot
@camperbot
Sep 14 2015 10:07

:fire:Bonfire: Check for Palindromes :link:

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



palindrome("eye");

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

more info:  bf details | bf links | hint

Roy
@CruelCoin
Sep 14 2015 10:08
@RavenFuentes What are you stuck on? Can we see your code so far?
Raven Fuentes
@RavenFuentes
Sep 14 2015 10:10
that is my problem i cant start my code i dont know how to start
Aleksander Gębicki
@Takumar
Sep 14 2015 10:11
@smarshy I think that it is a good moment for you to check regexone.com page about regular expressions.
Roy
@CruelCoin
Sep 14 2015 10:11
@smarshy Removing the punctuation can be done with regex. Find all the punctuation, and create a new string with the punctuation replaced with nothing.
var lowercaseNoPuntuation = lowerCaseStr.replace(/[\W_]+/g,"");
Aleksander Gębicki
@Takumar
Sep 14 2015 10:13
@smarshy if you will spend some time on page which I redirected you, you will understand what does these strange characters mean which @CruelCoin typed you in :-)
Vatsala Swaroop
@smarshy
Sep 14 2015 10:14
yup.I checked it out.Really helpful.Thank you so much :)
CamperBot
@camperbot
Sep 14 2015 10:14
if you want to thank someone, put an @ before their name!
Vatsala Swaroop
@smarshy
Sep 14 2015 10:14
@Takumar thanks
Aleksander Gębicki
@Takumar
Sep 14 2015 10:15
@smarshy if you want to thank someone you have to type it the other way: thanks @smarshy
CamperBot
@camperbot
Sep 14 2015 10:15
takumar sends brownie points to @smarshy and @smarshy :sparkles: :thumbsup: :sparkles:
:star: 174 | @smarshy | http://www.freecodecamp.com/smarshy
:star: 174 | @smarshy | http://www.freecodecamp.com/smarshy
Roy
@CruelCoin
Sep 14 2015 10:19
Ina nutshell raven @RavenFuentes : you need to change to string to all lowercase, then remove punctuation with regex, then split string and create an array from that. Finally, reverese the string with array.reverse(), and then return the resuklt
Try each step one at a time, using console.log() to make sure each step is working out like you expect.
Raven Fuentes
@RavenFuentes
Sep 14 2015 10:22
ok i'll try it tnx buddy @CruelCoin
CamperBot
@camperbot
Sep 14 2015 10:22
ravenfuentes sends brownie points to @cruelcoin :sparkles: :thumbsup: :sparkles:
:star: 223 | @cruelcoin | http://www.freecodecamp.com/cruelcoin
Roy
@CruelCoin
Sep 14 2015 10:23
@RavenFuentes Welcome
Aleksandar B.
@aleksandar-b
Sep 14 2015 10:25
Wikipedia viewer Zipline, I don't know which Api to use. Anyone knows how to write Api to retrieve search content?
urvashi9
@urvashi9
Sep 14 2015 10:41

function largestOfFour(arr) {
// You can do this!
var maxnum=0;
var i=0;
var array=arr[i];

for(var i=0;i<arr.length;i++) { for(var j=0;j<array.length;j++) { var max=Math.max.apply(array[i]); if(max>maxnum)
{
maxnum=max;
var maxarray=array;
}
}
}
return maxarray;
}

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

function largestOfFour(arr) {
  // You can do this!
  var maxnum=0;
  var i=0;
  var array=arr[i];

  for(var i=0;i<arr.length;i++)
    {
      for(var j=0;j<array.length;j++)
        {
          var max=Math.max.apply(array[i]);
          if(max>maxnum)
            {
              maxnum=max;
              var maxarray=array;
            }
        }
    }
  return maxarray;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Can anyone tell me what is wrong in this code?
The output needs to be an array that has the maximum number in it.
Cong Li
@lee5214
Sep 14 2015 10:48
why you var maxarray=array?
urvashi9
@urvashi9
Sep 14 2015 10:49
So if the max number found in that particular subarray is greater than "maxnum", that subarray will become the maxarray, which we want to return. We don't want the max number, we want the array that has the max number.
Cong Li
@lee5214
Sep 14 2015 10:52
@urvashi9 oh i didnt see var array=arr[i]....you dont need to var a new array for the 2-d array, you can use array[0][0] for the first element which is "4"
urvashi9
@urvashi9
Sep 14 2015 10:53
I am sorry, I don't understand. :(
Cong Li
@lee5214
Sep 14 2015 10:55
its like arr[0][0]=4 arr[1][0]=13 for the test case
urvashi9
@urvashi9
Sep 14 2015 10:56
@lee5214 Okay, so instead of my current statement I should change it to arr[0][0]=4? and that will work?
Cong Li
@lee5214
Sep 14 2015 10:57
use arr[i][j] in the loop, then use some loop to manipulate the array
im working on my project, so i could just show u my code if u wanna learn from it
urvashi9
@urvashi9
Sep 14 2015 10:58
Oh yes. That is what I am trying. Will get back to you with the results. :)
No no. I am going to try and figure it out myself.
But thank you @lee5214
CamperBot
@camperbot
Sep 14 2015 10:58
urvashi9 sends brownie points to @lee5214 :sparkles: :thumbsup: :sparkles:
:star: 211 | @lee5214 | http://www.freecodecamp.com/lee5214
Cong Li
@lee5214
Sep 14 2015 11:00
aha good spirit~
vkarla
@vkarla
Sep 14 2015 11:04
@alanbuchanan Ok, it doesn't count if I put it separate or all in one statement. The problem is not this. It means the same for the program. The problem is that the last example in this practice is not a palindrome (with my logic ), but it it set as palindrome. Anyway, thank you for answer. :)
CamperBot
@camperbot
Sep 14 2015 11:04
vkarla sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 344 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Rory Smith
@alanbuchanan
Sep 14 2015 11:07
@vkarla they're encouraging you to replace all non-word characters and underscores. if you do this, the last one is actually a palindrome :)
you're right, it doesn't matter whether you put your regex in one statement or split into several, but in this case it's standard practise to use just one
vkarla
@vkarla
Sep 14 2015 11:08
@alanbuchanan I just now read their answer, so I realized what is the problem. :) So thank you. :)
CamperBot
@camperbot
Sep 14 2015 11:08
vkarla sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:warning: vkarla already gave alanbuchanan points
Rory Smith
@alanbuchanan
Sep 14 2015 11:08
@vkarla :thumbsup:
Sina Montazeri
@sina-montazeri
Sep 14 2015 11:16
Hi I don't understand how this works,
could you help?
marzelin
@marzelin
Sep 14 2015 11:17
@sina-montazeri what exactly don't you understand?
Sina Montazeri
@sina-montazeri
Sep 14 2015 11:18
the code says return Math.floor(Math.random() * (max - min + 1 )) + min;
marzelin
@marzelin
Sep 14 2015 11:18
Math.floor rounds the number down
Sina Montazeri
@sina-montazeri
Sep 14 2015 11:19
yea but how does (max - min + 1 )) + min create a range?
marzelin
@marzelin
Sep 14 2015 11:19
Math.random() returns pseudo-random number between [0;1)
if you want range from 0 to 10 you multiply Math.random() * 10
max is the top of your range
min is the bottom of your range
Sina Montazeri
@sina-montazeri
Sep 14 2015 11:21
okay and lets say the random number is 0.3 and I multiply by 10 so I get 3, now what does +1 do in the second child parentheses?
and why do we do + min for a last time?
Cong Li
@lee5214
Sep 14 2015 11:23
its for the case that when min=max
Sina Montazeri
@sina-montazeri
Sep 14 2015 11:23
@lee5214 ohh..right
I get it now
Thank you guys
CamperBot
@camperbot
Sep 14 2015 11:24
if you want to thank someone, put an @ before their name!
Dennis Andersson
@deandersson
Sep 14 2015 11:32
@sina-montazeri the +1 is to give the max number equal odds of occuring. since if you do Math.random() * 10, the only chance to get 10 is when random() returns 1, while the chance to get 9 is when random() returns somewhere between 9.0-9.9
marzelin
@marzelin
Sep 14 2015 11:33
@deandersson actually Math.random() will never return 1
Dennis Andersson
@deandersson
Sep 14 2015 11:33
Ah den thats why then haha
marzelin
@marzelin
Sep 14 2015 11:37
+1 is just offset for min. Without it this expression would return numbers from min+1 to max, which is not what we want
Dennis Andersson
@deandersson
Sep 14 2015 11:39
@marzelin I think the +1 is for max.. because if you want a number between min=0 and max=10 you have to set max to 11 since random never returns 1. otherwise you would never be able to get max
with your reasoning the result would be a number between 1 and 10 excluding 10
no?
marzelin
@marzelin
Sep 14 2015 11:41
@deandersson you're right
Dennis Andersson
@deandersson
Sep 14 2015 11:41
:thumbsup:
marzelin
@marzelin
Sep 14 2015 11:46
thing is when we want nubers between 0 and 10 we want 11 values: 0,1,2,3,4,5,6,7,8,9,10, so we need to multiply random() by 11, while max - min would give us 10 - 0 = 10.
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 11:48
please what am i doing wrong
function palindrome(str) {
  str = str.replace(/[';,"'!]/g, "");
  str = str.toLowerCase();
  var strSplit = str.split('');
  var strReversed = strSplit.reverse();
  strReversed = strReversed.join();
  if (strSplit == strReversed) {
    return true;
  }
  else {
    return false;
  }

}



palindrome("eye");
Dennis Andersson
@deandersson
Sep 14 2015 11:49
join() takes an argument of what to put between each element. The default is a ,
so if you join [ "a", "b"] without arguments it would produce "a,b"
marzelin
@marzelin
Sep 14 2015 11:50
also if (strSplit == strReversed)should be if (str == strReversed)
DoRm
@DoRm
Sep 14 2015 11:52
That would also cause errors because strsplti is kind of doing nothing but splitting the string
marzelin
@marzelin
Sep 14 2015 11:53
@DoRm it stores an array of words from str
DoRm
@DoRm
Sep 14 2015 11:53
@marzelin Thats not what I'm saying
I am saying besides splitting the string its doing nothing else
right now he has three variables going on str, strplit, and strreversed
marzelin
@marzelin
Sep 14 2015 11:56
yeah strSplit and strReversed could be repleaced by just one variable
Dennis Andersson
@deandersson
Sep 14 2015 11:56
Are you talking about making the code more efficient? Like doing strReversed = str.split('').reverse().join('')?
DoRm
@DoRm
Sep 14 2015 11:57
@deandersson No right now he has a third variable thats sitting and doing nothing
strsplit is legit not part of that code at all
Dennis Andersson
@deandersson
Sep 14 2015 11:57
Its being used to create strReversed
DoRm
@DoRm
Sep 14 2015 11:57
ok and what is it doing after?
Dennis Andersson
@deandersson
Sep 14 2015 11:57
its "legit" but could be written using less code
It served its purpose, Its like saying strReverse is useless since its not being used after return
DoRm
@DoRm
Sep 14 2015 11:59
@deandersson You need to debug through that code again then
Dennis Andersson
@deandersson
Sep 14 2015 11:59
Honestly, I think you have missed something..
It is being used to create strReversed = strSplit.reverse()
Now one could argue it would be better to write it like strReversed = str.split('').reverse()
and then you would get rid of it
But in the current way it is written it is not just "sitting there and doing nothing"
marzelin
@marzelin
Sep 14 2015 12:02
@deandersson is right
Dennis Andersson
@deandersson
Sep 14 2015 12:03
and for someone that is learning the language and maybe programming for the first time there is an advantage of breaking it up in every small step instead of taking the shortcut
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:03
function palindrome(str) {
  str = str.replace(/[';,"'!]/g, " ");
  str = str.toLowerCase();
  var strTrans = str.split('').reverse().join('');
  if (str == strTrans) {
    return true;
  }
  else {
    return false;
  }

}



palindrome("Race Car");
how about writing it this way?
i broke the code earlier on so i could track each variable
it helped understand how things went
yet...at the moment am not getting a positive result
any help on how to go about this?
marzelin
@marzelin
Sep 14 2015 12:06
@kinsomicrote replace with nothing
not a " "
Dennis Andersson
@deandersson
Sep 14 2015 12:08
Also space should be replaces
marzelin
@marzelin
Sep 14 2015 12:08
also you need to add other special characters
to be replaced
like .
Dennis Andersson
@deandersson
Sep 14 2015 12:09
In my solution I replaced .``, and with ``
marzelin
@marzelin
Sep 14 2015 12:09
@kinsomicrote better yet try to find reg exp that excludes all special characters at once
Mikhail Evdokimov
@evdokimovm
Sep 14 2015 12:10
I finish JavaScript Slot Machine but i not understand how "Not A Win"
through with if ((slotOne !== slotTwo) || (slotTwo !== slotThree) || (slotThree !== slotOne)) return null; gets into <span class = "logger"></span> and output
Could you help me understand how it works?
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:10
like so: str = str.replace(/[';.><~(){}[]\/|,"'!]/g, "");`
marzelin
@marzelin
Sep 14 2015 12:11
@kinsomicrote try it
Dennis Andersson
@deandersson
Sep 14 2015 12:11
dont forget to replace also
(/ /g, '')
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:11
i think one of the issue am having is with the join
Mikhail Evdokimov
@evdokimovm
Sep 14 2015 12:12
null because it's just an empty value
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:12
when i enter the string: Never odd OR even
it becomes: neve ro ddo reven
Dennis Andersson
@deandersson
Sep 14 2015 12:13
str = str.replace(/ /g, '');
removes spaces
When I first learned regexp I used this site alot: http://www.regexr.com/
It helps to visualize what you are doing :)
Cong Li
@lee5214
Sep 14 2015 12:16
is the reg exp correct for your problem?
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:19
yes it is
marzelin
@marzelin
Sep 14 2015 12:19
@kinsomicrote try this expression /[\W_]/
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:20
@marzelin where?
marzelin
@marzelin
Sep 14 2015 12:20
str = str.replace(/[\W_]/g, "");
Dennis Andersson
@deandersson
Sep 14 2015 12:21
@marzelin that one was handy and nice!
I was about to post, str = str.replace(/[';,"'!\. '?:/\-_()]/g, "");
haha
marzelin
@marzelin
Sep 14 2015 12:23
that's a lot of typing :)
Dennis Andersson
@deandersson
Sep 14 2015 12:23
haha yes guess thats why they added \W to regex haha
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:26
i think the issue was with the spacing
through @marzelin and @deandersson i was able to get the error
i thought it was from the join()
thanks @marzelin @deandersson
CamperBot
@camperbot
Sep 14 2015 12:27
kinsomicrote sends brownie points to @marzelin and @deandersson :sparkles: :thumbsup: :sparkles:
:star: 200 | @marzelin | http://www.freecodecamp.com/marzelin
:star: 258 | @deandersson | http://www.freecodecamp.com/deandersson
Dennis Andersson
@deandersson
Sep 14 2015 12:28
:thumbsup:
Cong Li
@lee5214
Sep 14 2015 12:29
you can use multiple replace(), i find it's much easier for me to learn regexp
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:30
@lee5214 example?
Cong Li
@lee5214
Sep 14 2015 12:31
something like
str.replace(/\s+/g, '').replace(/,+/gi,'')....
Dennis Andersson
@deandersson
Sep 14 2015 12:32
Though in this example it would be tedious as @marzelin pointed out.. xD
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:32
I am still trying to learn regex
kaubin05
@kaubin05
Sep 14 2015 12:33
Hello, can anyone lead me to a possible way to get the twitter button working on the "Zipline: Build a Random Quote Machine" challenge. I have everything else working but I just can't grasp how I am supposed to send the variable off to twitter...
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:33
this exercise was helpful
Dennis Andersson
@deandersson
Sep 14 2015 12:33
@kinsomicrote check out http://www.regexr.com/ helped me alot when I first started with rexex
  • regex
Kingsley Silas Chijioke
@kinsomicrote
Sep 14 2015 12:34
okay
bookmarked!
Jason Wood
@catapixel
Sep 14 2015 12:53
Has anyone done the Git waypoint, specifically the "GitHubbin" challenge?
marzelin
@marzelin
Sep 14 2015 12:55
@catapixel yep
Jason Wood
@catapixel
Sep 14 2015 12:59
@marzelin I updated my username correctly but I'm failing the last three tests...ideas?
catapixel@git-it:~/workspace/hello-world (master) $ git-it verify
Verifying "GITHUBBIN"...

ACTUAL                             EXPECTED
------                             --------
"Username added to Git config!"    "Username added to Git config!"
""                              != "You're on GitHub!"            
null                            != "Git config!"                  
null                            != ""                             
# FAIL

Your solution to GITHUBBIN didn't match the expected output.
Try again!
marzelin
@marzelin
Sep 14 2015 13:00

A common error is not having your GitHub username match the case of the one you set with git config. For instance, 'JLord' isn't the same as 'jlord'

To change your username set with Git, just do the same command you did earlier, but with the correct capitalization:

$ git config --global user.username <USerNamE>

When you've made your updates, verify again!

Jason Wood
@catapixel
Sep 14 2015 13:01
catapixel@git-it:~/workspace/hello-world (master) $ git config -l
user.name=Jason Wood
user.email=[my correct email address]
user.username=catapixel
core.editor=nano
core.whitespace=off
core.excludesfile=~/.gitignore
advice.statusuoption=false
color.ui=true
push.default=simple
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
catapixel@git-it:~/workspace/hello-world (master) $ git-it verify
Verifying "GITHUBBIN"...
Already tried that. The cloud 9 was created/signed in with my github account and all info is correct
marzelin
@marzelin
Sep 14 2015 13:07
@catapixel strange, seems correct. Try to change user.name to catapixel as well, maybe it helps
@catapixel i've changed my username to yours and it also worked
Jason Wood
@catapixel
Sep 14 2015 13:13
@marzelin I'll keep working on it. So far no luck.
marzelin
@marzelin
Sep 14 2015 13:13
try to restart c9
Jason Wood
@catapixel
Sep 14 2015 13:15
I just did and still no luck...can I try it with your creds to see what happens?
marzelin
@marzelin
Sep 14 2015 13:17
sure
Jason Wood
@catapixel
Sep 14 2015 13:18
is marzelin your username?
marzelin
@marzelin
Sep 14 2015 13:18
yes
Jason Wood
@catapixel
Sep 14 2015 13:19
when I swapped my username for yours I still fail. There must be something wrong on my end if you're passing...
marzelin
@marzelin
Sep 14 2015 13:20
maybe it can't connect with github, but why?
Soumya Rauth
@soumyaRauth
Sep 14 2015 13:21
What is the best way to store a input text in Jquery?
marzelin
@marzelin
Sep 14 2015 13:22
@soumyaRauth variable?
Soumya Rauth
@soumyaRauth
Sep 14 2015 13:24
@marzelin I am sorry because my qu was not clear. If someone put something in a textbox then which method will work best if i want to take that text and store them in a variable?
Jason Wood
@catapixel
Sep 14 2015 13:30
@marzelin I'm wondering now if it has to do with the connection? I'm seeing on github about ssh and keys...did you store your password or setup a key on your cloud 9?
marzelin
@marzelin
Sep 14 2015 13:32
@catapixel i don't remeber doing that
@catapixel later in the challenge you'll have to connect with your account, which needs you to enter your username and password, but it doesn't store it anywhere on c9
Aleksandar B.
@aleksandar-b
Sep 14 2015 13:35
should i use some already made template for Javascript calculator zipline?
Jason Wood
@catapixel
Sep 14 2015 13:35
@marzelin I'm going to try creating a new workspace and see if I still have problems...
marzelin
@marzelin
Sep 14 2015 13:35
@catapixel that's a good idea
good luck
@samosale ideally you should make it from scratch
@soumyaRauth textarea has a value attribute in which it stores user input
Soumya Rauth
@soumyaRauth
Sep 14 2015 13:39
@marzelin document.getElementById().value ......Why it is not working?
marzelin
@marzelin
Sep 14 2015 13:40
@soumyaRauth did you specify correct Id in the parentheses enclosed with ' '?
Soumya Rauth
@soumyaRauth
Sep 14 2015 13:40
@marzelin Yes
Jason Wood
@catapixel
Sep 14 2015 13:41
@marzelin It worked just fine in the new space. Still don't understand the original problem but I'm moving on. Thanks for the help!
CamperBot
@camperbot
Sep 14 2015 13:41
catapixel sends brownie points to @marzelin :sparkles: :thumbsup: :sparkles:
:star: 201 | @marzelin | http://www.freecodecamp.com/marzelin
marzelin
@marzelin
Sep 14 2015 13:41
@catapixel :+1:
@soumyaRauth can you paste the code here?
Soumya Rauth
@soumyaRauth
Sep 14 2015 13:42

//This is the Html part

<form class="navbar-form text-center" >
   <input type="text" class="form-control " id="texty">
   <button type="submit" class="btn btn-default" id="search"><span class="glyphicon glyphicon-search"></span></button>
    </form>

//Below is the Jquery part @marzelin
```
$("#search").click(function(){

x=document.getElementById("texty").value;
$('h1').text(x);
});
});

$("#search").click(function(){
x=document.getElementById("texty").value;
$('h1').text(x);
});
});
h1 is at the top of my page...
@marzelin I declared x at the top...
Daniel O'Mahony
@OMahonyD
Sep 14 2015 13:46
Bonfire: Repeat a String >> What am I doing wrong? Arrgh...
function repeat(str, num) {
  var finalStr = '';

  for(var i = 0; i <= num; i++) {
    finalStr += str;
  }

  return finalStr;
}

repeat('abc', 3);
CamperBot
@camperbot
Sep 14 2015 13:46
Sorry, can't find a bonfire called repeat a string what am i doing wrong arrghfunction repeatstr num var finalstr forvar i 0 i num i finalstr str return finalstrrepeatabc 3. [ Check the map? ]
Daniel O'Mahony
@OMahonyD
Sep 14 2015 13:4