These are chat archives for FreeCodeCamp/HelpJavaScript

1st
May 2016
Kyle B.
@manbearkyle
May 01 2016 00:02
@sjames1958gm here's the revised. Is my main problem the way I'm calling the values or is it improper notation?
function lookUpProfile(firstName, prop){
  for (i = 0; i < contacts.length; i++) {
    if (i.firstName == firstName)
      return i.lastName;
  }
Diego Mayer
@Chrono79
May 01 2016 00:05
@scarlettbrooke1221 set gear = change not += change
Bobby McDonald
@BobbyMcWho
May 01 2016 00:06
@Benalron I fixed it
You had kind of a mess
Diego Mayer
@Chrono79
May 01 2016 00:06
@manbearkyle i is a number, it has no property named firstName
Kevin
@KevinBruland
May 01 2016 00:07
@BobbyMcWho how so?
Erica Mitchell
@scarlettbrooke1221
May 01 2016 00:07
@Chrono79 thank you!!! i knew it was something simple i kept missing. thanks!
CamperBot
@camperbot
May 01 2016 00:07
scarlettbrooke1221 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star: 571 | @chrono79 | http://www.freecodecamp.com/chrono79
Bobby McDonald
@BobbyMcWho
May 01 2016 00:09
@Benalron
//You don't need to redefine randomNumber
    //var randomNumber = Math.floor(Math.random()*quotes.length);
        $(".tardis").fadeTo(1200, 0);
        $(".quote-box").fadeTo(1200, 0, randomQuote);
    //load your widget inside of randomQuote instead
        //twttr.widgets.load();
Diego Mayer
@Chrono79
May 01 2016 00:10
@manbearkyle look at your loop, you have to use contacts inside too
Kevin
@KevinBruland
May 01 2016 00:10
that was the first thing I tried, but it did not work
Bobby McDonald
@BobbyMcWho
May 01 2016 00:10
It works perfectly for me
Kevin
@KevinBruland
May 01 2016 00:10
and stopped the get a new quote button from working entirely
Bobby McDonald
@BobbyMcWho
May 01 2016 00:11
@Benalron you may have some weird brackets places too, I found a couple in brackets
there's the working js, compare with your own
var randomQuote = function(){
    var randomNumber = Math.floor(Math.random()*quotes.length);
    $(".quote-box").html("<p class='quote-text'>" + quotes[randomNumber].quote + "</p> <p class='author-text'>- " + quotes[randomNumber].author + "</p>" + '<a href="https://twitter.com/share" class="twitter-share-button" data-text="'+quotes[randomNumber].quote+'">Tweet</a>');
    twttr.widgets.load();
};
hjernefrys
@hjernefrys
May 01 2016 00:14

Trying to make a weather app, but I have problem with the parsing. codepen uses https and openweather's api uses http it seems, the error I get is:

jquery.min.js:4 Mixed Content: The page at 'https://s.codepen.io/boomerang/f0d75f84401d42e69d8db0b5af39ac771462061508349/index.html?editors=1111' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://api.openweathermap.org/data/2.5/weather?lat=99.825735099999996&lon=8.7575783&APPID=a7eacef87f4bf64adb1780619a4e32fe'. This request has been blocked; the content must be served over HTTPS.

is there anything I can do about this?

Kevin
@KevinBruland
May 01 2016 00:14
@BobbyMcWho still doesnt work for me with twttr.widgets.load();
Bobby McDonald
@BobbyMcWho
May 01 2016 00:14
send me your updated codepen
Kyle B.
@manbearkyle
May 01 2016 00:19
@Chrono79 like so?
function lookUpProfile(firstName, prop){
  for (i = 0; i < contacts.length; i++) {
    if (contacts.firstName == firstName)
      return contacts.lastName;
  }
llamatarianism
@llamatarianism
May 01 2016 00:19
@Chrono79 you need to use bracket notation
lookUpProfile("Akira", "likes");
=> contacts.firstName // => undefined
in contrast to:
Diego Mayer
@Chrono79
May 01 2016 00:20
@llamatarianism not me ;), @manbearkyle
llamatarianism
@llamatarianism
May 01 2016 00:20
lookUpProfile("Akira", "likes");
=> contacts[firstName]
=> contacts["Akira"] // not undefined
oh whoops.
@manbearkyle
Diego Mayer
@Chrono79
May 01 2016 00:20
@manbearkyle you have to use your loop index i too
Like @ndburrus posted below
Norvin Burrus
@ndburrus
May 01 2016 00:20
@manbearkyle
js
<if (firstName === contacts[i].firstName)>
Norvin Burrus
@ndburrus
May 01 2016 00:26
@manbearkyle a var/iable (i) is being used (as opposed to the direct reference to firstName) to check if firstName exists in each key (of key:value pair).
Bobby McDonald
@BobbyMcWho
May 01 2016 00:27
@Benalron you're not calling your JS source in codepen
@Benalron click the settings gear for the JS editor and add this source without quotes "https://platform.twitter.com/widgets.js"
Norvin Burrus
@ndburrus
May 01 2016 00:29
@manbearkyle a next step would be to a) return a "no such property," if the firstName value does not exist (as the property of it cannot exist if the firstname is not present). b) [if the firstName value is present] further evaluate that scenario to determine if the given (user inputted) property value is also present.
Bobby McDonald
@BobbyMcWho
May 01 2016 00:30
oy vey I took soo much time to figure that out lol
Kevin
@KevinBruland
May 01 2016 00:31
@BobbyMcWho thank you a ton man... thats exactly what I was missing
CamperBot
@camperbot
May 01 2016 00:31
benalron sends brownie points to @bobbymcwho :sparkles: :thumbsup: :sparkles:
:star: 285 | @bobbymcwho | http://www.freecodecamp.com/bobbymcwho
Kevin
@KevinBruland
May 01 2016 00:31
@BobbyMcWho I didn't realize you had to call it there
@BobbyMcWho I thought js.src = withing the window.twttr function took care of that
Bobby McDonald
@BobbyMcWho
May 01 2016 00:31
Your script calls it once for the initial load, but you need to call it as a source in your main file just to be safe
It calls it when you define that variable I believe at the beginning, but I'm not sure how the twitter widget works exactly
I'm still working on my twitter functionality, but took a totally different approach
Kevin
@KevinBruland
May 01 2016 00:35
well, thanks a ton
was stuck on that for a long time
Leo Berlin
@leober
May 01 2016 00:48
I got stuck on the counting cards exercise http://codepen.io/leober/pen/YqjmWM
Kyle B.
@manbearkyle
May 01 2016 00:48
@ndburrus @Chrono79 ok so as of now I've successfully ran "Kristian", "lastName" and "Bob", "number" should return "No such contact". To get the loop to run the entire gamut should I be writing a new else if statement like below, or should I be writing a new for loop?
function lookUpProfile(firstName, prop){
  for (i = 0; i < contacts.length; i++) {
    if (firstName === contacts[i].firstName)
      return contacts[i].lastName;

    else if (firstName === contacts[i].firstName)
      return contacts[i].likes;
  }

return "No such contact";
}

// Change these values to test your function
lookUpProfile("Sherlock", "likes");
Leo Berlin
@leober
May 01 2016 00:48
I am not sure what I am doing wrong
rphares
@rphares
May 01 2016 00:48
Hey, @leober !
You currently are returning everytime,
Diego Mayer
@Chrono79
May 01 2016 00:49
@manbearkyle only one loop is fine
but your if's are not ok
Leo Berlin
@leober
May 01 2016 00:49
@rphares What that means?
rphares
@rphares
May 01 2016 00:49
what happens when you return? @leober
Robert
@Brayn7
May 01 2016 00:49

is there a better way?

function sumAll(arr) {
var max = Math.max(arr1,arr0),
min = Math.min(arr1, arr0),
range = [];
for (var i = min; i <= max; i++){
range.push(i);
}
return range.reduce(function(a,b){
return a+b;
});
}

sumAll([1, 4]);

rphares
@rphares
May 01 2016 00:49
it means, as it is written,if the card is XXX then return XXX, right? @leober
Leo Berlin
@leober
May 01 2016 00:49
@rphares I get few answers right
yes
rphares
@rphares
May 01 2016 00:49
and thats all. when you return, it just runs once,
but...
dontchaknow
@dontchaknow
May 01 2016 00:50
function palindrome(str) { // Good luck! var strReversed = str.toLowerCase().replace(/\W/, "")
rphares
@rphares
May 01 2016 00:50
in tests, you get five cards
@leober
Diego Mayer
@Chrono79
May 01 2016 00:50
help profile lookup
CamperBot
@camperbot
May 01 2016 00:50
no wiki entry for: lookup profile
rphares
@rphares
May 01 2016 00:50
so, you need to take those returns out, @leober , and save the return for the end,
dontchaknow
@dontchaknow
May 01 2016 00:50
my replace isnt working. I want to replace all nonalphanumeric characters
Leo Berlin
@leober
May 01 2016 00:50
@rphares write instead of return, what?
rphares
@rphares
May 01 2016 00:50
instead, you can increment or decrement count++ or count-- for example, @leober
then, at the end, add an if/else,
Diego Mayer
@Chrono79
May 01 2016 00:50

@manbearkyle
The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.

If both are true, then return the "value" of that property.

If firstName does not correspond to any contacts then return "No such contact"

If prop does not correspond to any valid properties then return "No such property"

henrywashere
@henrywashere
May 01 2016 00:51
need help with this exercise:
Instructions
Change the chained if/if else statements into a switch statement.
  if (val === "bob") {
    answer = "Marley";
  } else if (val === 42) {
    answer = "The Answer";
  } else if (val === 1) {
    answer = "There is no #1";
  } else if (val === 99) {
    answer = "Missed me by this much!";
  } else if (val === 7) {
    answer = "Ate Nine";
  }
rphares
@rphares
May 01 2016 00:51
that says if count is above zero, it will return XXX and the right string. and if count is below zero, it will return count and the other string, @leober
Diego Mayer
@Chrono79
May 01 2016 00:51
@henrywashere
switch (you function parameter here) {
  case "bob": 
    answer = "Marley";
    break;
  case...
}
Leo Berlin
@leober
May 01 2016 00:52
@rphares ok I will try that
henrywashere
@henrywashere
May 01 2016 00:52
cool thats what i did for the first part
rphares
@rphares
May 01 2016 00:52
Awesome! Happy coding, @leober ~
henrywashere
@henrywashere
May 01 2016 00:52
how about the next one?
case "bob"
        answer = "Marley";
        break;
dontchaknow
@dontchaknow
May 01 2016 00:52
never mind i had to set it to g for global match
Leo Berlin
@leober
May 01 2016 00:53
@rphares :thumbsup:
henrywashere
@henrywashere
May 01 2016 00:53
oh thats what i did @Chrono79
but i get an error message
Diego Mayer
@Chrono79
May 01 2016 00:53
@henrywashere paste your switch then
henrywashere
@henrywashere
May 01 2016 00:55
oh nevermind iforgot to put a colon
thanks @Chrono79
CamperBot
@camperbot
May 01 2016 00:55
henrywashere sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star: 572 | @chrono79 | http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
May 01 2016 00:56
no problem
dontchaknow
@dontchaknow
May 01 2016 01:01

str = "A man, a plan, a canal. Panama"

str.toLowerCase().replace(/\W\s/g, "") isn't removing all spaces. instead I get back "a mana plana canalpanama"

Diego Mayer
@Chrono79
May 01 2016 01:02
@dontchaknow str.toLowerCase().replace(/\W/g, "");
and you'll want to add something to make the last test work too
dontchaknow
@dontchaknow
May 01 2016 01:03
do you know why \s messes things up?
its not part of the exercise but im curious
Diego Mayer
@Chrono79
May 01 2016 01:05
@dontchaknow not sure
dontchaknow
@dontchaknow
May 01 2016 01:05
oh never mind I remember now. when I have \W\s it's looking for a pattern replacement where it has to be a non alphanumeric followed by a space.
so the parts with just a space don't follow the pattern
Diego Mayer
@Chrono79
May 01 2016 01:06
@dontchaknow yes, that's it
dontchaknow
@dontchaknow
May 01 2016 01:13
how do I exclude underscores? I know I can do it if I write out ^a-zA-Z0-9 but is there a more concise way
because \W includes underscores
rphares
@rphares
May 01 2016 01:13
help regex
CamperBot
@camperbot
May 01 2016 01:13

:point_right: js regex resources [wiki]

Links to useful RegEx resources.

See also: :clipboard: Tutorials | :syringe: Testing | :soccer: Games | :newspaper: Blogs | :package: Software

:pencil: read more about js regex resources on the FCC Wiki

llamatarianism
@llamatarianism
May 01 2016 01:14
@dontchaknow use |
matches one thing or another thing
rphares
@rphares
May 01 2016 01:14
You may wanna check out the links-- regex will come up a lot, its worth diving into, think :blush:
llamatarianism
@llamatarianism
May 01 2016 01:14
\W|_
Diego Mayer
@Chrono79
May 01 2016 01:16
@dontchaknow also you can write this: /[^a-zA-Z0-9]/ more concise like this /[^a-z0-9]/i
but /\W|_/ is shorter
dontchaknow
@dontchaknow
May 01 2016 01:16
thanks
llamatarianism
@llamatarianism
May 01 2016 01:19
if I could travel back in time
I'd go back and beat the tar out of whoever decided _ was a word character
Himanshu Batra
@manshu
May 01 2016 01:25
Who's is good in php here?
Hello World
CamperBot
@camperbot
May 01 2016 01:25

welcome to FreeCodeCamp @manshu!

Kyle B.
@manbearkyle
May 01 2016 01:26
@Chrono79 @ndburrus thanks for the help completing the lookup checkpoint :smile:
CamperBot
@camperbot
May 01 2016 01:26
manbearkyle sends brownie points to @chrono79 and @ndburrus :sparkles: :thumbsup: :sparkles:
:star: 290 | @ndburrus | http://www.freecodecamp.com/ndburrus
:star: 573 | @chrono79 | http://www.freecodecamp.com/chrono79
Norvin Burrus
@ndburrus
May 01 2016 01:27
@manbearkyle Anytime! Did it work for you?
@manbearkyle You're on FIRE! :fire:
Diego Mayer
@Chrono79
May 01 2016 01:28
@llamatarianism hahaha, maybe that was because it was a valid character to use as a var name, dunno
Blake Harris
@bharris62
May 01 2016 01:32
howdy howdy
Norvin Burrus
@ndburrus
May 01 2016 01:33
@bharris62 hi
Mike Olie
@SwiftMike
May 01 2016 01:38
quick question using bracket notation accessing Objects Properties with Variables
Johnathan Brown
@Legend28469
May 01 2016 01:39
@FreshSteak what’s up?
Mike Olie
@SwiftMike
May 01 2016 01:39

// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber; // Change this Line
var player = testObj["16"]; // Change this Line

Norvin Burrus
@ndburrus
May 01 2016 01:40
@FreshSteak Hi Mike! Which challenge is this?
Rada
@Radascript
May 01 2016 01:40
help Format
CamperBot
@camperbot
May 01 2016 01:40

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

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

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

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

Norvin Burrus
@ndburrus
May 01 2016 01:40
@FreshSteak oh, i see it...
Johnathan Brown
@Legend28469
May 01 2016 01:42
@FreshSteak what’s wrong with it?
Mike Olie
@SwiftMike
May 01 2016 01:42
i need to get playNumber to retrieve a number
Norvin Burrus
@ndburrus
May 01 2016 01:42
@FreshSteak i guess i have the wrong challenge
Mike Olie
@SwiftMike
May 01 2016 01:42
using bracket notation
accessing object variables with bracket notation
@ndburrus
Johnathan Brown
@Legend28469
May 01 2016 01:43
@FreshSteak you have it though. Just add this —> https://repl.it/CLkY
Rada
@Radascript
May 01 2016 01:43
@FreshSteak ok so it wants you to manually set player number to 16, and then use the second variable to check the last name of 16 using playerNumber variable
Vivek
@vivek28111992
May 01 2016 01:44
@Radascript hi
Mike Olie
@SwiftMike
May 01 2016 01:44
@Radascript yeah i guess
Rada
@Radascript
May 01 2016 01:44
so just make playerNumber 16, and then instead of having ["16"] in the bracket, put the variable in the bracket (like this--> testObj[playerNumber])
Johnathan Brown
@Legend28469
May 01 2016 01:44
^
Rada
@Radascript
May 01 2016 01:44
@vivek28111992 hi vivek
it's kind of a dumb challenge haha
bitgrower
@bitgrower
May 01 2016 01:44
hello @vivek28111992
Vivek
@vivek28111992
May 01 2016 01:45
@bitgrower yo
@bitgrower how is your weekend?
bitgrower
@bitgrower
May 01 2016 01:45
good ... getting close to having my 2014 taxes filed ... YAY!!!!
Norvin Burrus
@ndburrus
May 01 2016 01:46
@FreshSteak looks like your getting help. that is a different challenge than Accessing Objects Properties with Bracket Notation
bitgrower
@bitgrower
May 01 2016 01:46
I just need to get some forms signed & returned to my tax guy ... since I don't happen to have a printer ... it's a bit challenging ...
Mike Olie
@SwiftMike
May 01 2016 01:46
@ndburrus well did you do using objects for Lookups?
@Radascript thanks a lot that worked:D
CamperBot
@camperbot
May 01 2016 01:46
freshsteak sends brownie points to @radascript :sparkles: :thumbsup: :sparkles:
:star: 334 | @radascript | http://www.freecodecamp.com/radascript
Vivek
@vivek28111992
May 01 2016 01:46
2014? are you not paying tax to early?
Norvin Burrus
@ndburrus
May 01 2016 01:47
@FreshSteak moment... u didnt say that...
@FreshSteak thats still not the same challenge
Rada
@Radascript
May 01 2016 01:47
@FreshSteak np!
Norvin Burrus
@ndburrus
May 01 2016 01:47
@FreshSteak just look at the title...
Mike Olie
@SwiftMike
May 01 2016 01:47
@ndburrus i know its a whole different one i need help with as well
Rada
@Radascript
May 01 2016 01:47
@ndburrus his challenge name was Accessing Objects Properties with Variables
bitgrower
@bitgrower
May 01 2016 01:47
LOL @vivek28111992 -- taxes have long since been paid ... just need to file the tax returns ...
CamperBot
@camperbot
May 01 2016 01:47
bitgrower sends brownie points to @vivek28111992 :sparkles: :thumbsup: :sparkles:
:star: 516 | @vivek28111992 | http://www.freecodecamp.com/vivek28111992
Mike Olie
@SwiftMike
May 01 2016 01:47
@ndburrus @Radascript yes i needed help with two i got the first one
the second one is Using Objects for Lookups
I have

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {
alpha:"Adams",
bravo:"Boston",
charlie:"Chicago",
delta:"Denver",
echo:"Easy",
foxtrot:"Frank"

};

// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("charlie");

phoneticLookup isn't pulling any variables
bitgrower
@bitgrower
May 01 2016 01:49
???
Vivek
@vivek28111992
May 01 2016 01:49
paperwork...from which country do you belong? @bitgrower
Rada
@Radascript
May 01 2016 01:50
@FreshSteak when pasting code, use the formatting to make it visually easy to read. Post three of tildes: ``` (key above tab) then shift+enter, paste your code, then ctrl+enter
Vivek
@vivek28111992
May 01 2016 01:50
help format
CamperBot
@camperbot
May 01 2016 01:50

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

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

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

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

bitgrower
@bitgrower
May 01 2016 01:50
US, @vivek28111992
Norvin Burrus
@ndburrus
May 01 2016 01:50
@FreshSteak the code is returning exacly what it was told to return...
Mike Olie
@SwiftMike
May 01 2016 01:50
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
  var lookup =  {
    alpha:"Adams",
    bravo:"Boston",
    charlie:"Chicago",
    delta:"Denver",
    echo:"Easy",
    foxtrot:"Frank"

  };

  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("charlie");
Norvin Burrus
@ndburrus
May 01 2016 01:50
@FreshSteak ....examine what is asked to be returned....
@FreshSteak can you see it?
bitgrower
@bitgrower
May 01 2016 01:51
@FreshSteak -- you have to use val to index into the lookup object to get the return value
you aren't doing a thing with result -- it's set to the empty string, and you don't change it ... you need to change it ...
Rada
@Radascript
May 01 2016 01:52
anyway, that challenge also wants you to use a bracket notation within the Lookup function.
So you have an object variable called lookup.
Within it, you have a few key-value pairs.
Now, say a user wants to use your function to lookup a value of a key within your object. You want your function to return the value corresponding to user's input
Norvin Burrus
@ndburrus
May 01 2016 01:52
@FreshSteak somehow, the inputted/given information (variable - val) needs to correlate to the key/value pairs in the lookup table
missNasser
@missNasser
May 01 2016 01:52
hey i know im in the javascript fourm but dose anyone know a code for batch that can search your whole computer for curtian name files and list them then give you a choice to delete them
Mike Olie
@SwiftMike
May 01 2016 01:53
@ndburrus i see, i can't use result, so which variable is it going to be?
Norvin Burrus
@ndburrus
May 01 2016 01:53
@FreshSteak which variable is asked for in the program at the beginning?
Diego Mayer
@Chrono79
May 01 2016 01:53
@FreshSteak you must use result
bitgrower
@bitgrower
May 01 2016 01:53
@Freshsteak, you can use result -- you just have to set it to a value
Dylan
@dhcodes
May 01 2016 01:53
@missNasser use the search function of windows
missNasser
@missNasser
May 01 2016 01:54
lol i know i can use the search function but i would like to make a batch version of it
if it is possible
Mike Olie
@SwiftMike
May 01 2016 01:54
@ndburrus val
Norvin Burrus
@ndburrus
May 01 2016 01:54
@FreshSteak hint: the lookup table can use a var/iable to search for and match a key in the key/value pairs
Rada
@Radascript
May 01 2016 01:55
your user is going to say something like phoneticLookup("charlie")
And then you want your function return:
lookup["charlie"]
So make sure your "result" is set to that
bitgrower
@bitgrower
May 01 2016 01:55
is there some reason you want to re-invent the wheel, @missNasser ?
Jamie C
@jamiec92
May 01 2016 01:56
finding this one confusing the convert celsius to fahrenheit challenge?
Norvin Burrus
@ndburrus
May 01 2016 01:56
@FreshSteak so, now you have a variable (result) that needs to be assigned to a key value in the lookup object
missNasser
@missNasser
May 01 2016 01:56
yes there is im sorting out my files and there are so many and i would like a search and delete tool that can go through my files find all the files called eg eminem and it will show will list all the files called eminem and let me delete them in one go
I know i can use search function and do this but i thourght it would be a cool idea to make a batch file to do this for me
EricOber
@EricOber
May 01 2016 01:57
hey goys I am working on the Introduction to JSON challenge. I think my code is right, but its not working. can someone help?
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }

  {
    "artist": "Hometown Band",
    "title": "Garage Rock",
    "release_year": "2016",
    "formats": [
      "CS",
      "8T",
      "LP",
      "MP3"],

  }
    ];
Norvin Burrus
@ndburrus
May 01 2016 01:59
@Am3ricanPaladin hint: what value is in the given array, that is not included in the array you created?
EricOber
@EricOber
May 01 2016 01:59
gold
Norvin Burrus
@ndburrus
May 01 2016 01:59
@FreshSteak how are you doing?
Mike Olie
@SwiftMike
May 01 2016 01:59
```
EricOber
@EricOber
May 01 2016 02:00
a boolean
Mike Olie
@SwiftMike
May 01 2016 02:00
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
  var lookup = {
    alpha:"Adams",
    bravo:"Boston",
    charlie:"Chicago",
    delta:"Denver",
    echo:"Easy",
    foxtrot:"Frank"

  };

  // Only change code above this line
  return lookup[val];
}

// Change this value to test
phoneticLookup("charlie");
Norvin Burrus
@ndburrus
May 01 2016 02:00
@Am3ricanPaladin aahh.... so, now what?
@FreshSteak hmmm.... how are assignments created/defined?
Mike Olie
@SwiftMike
May 01 2016 02:00
@ndburrus @Radascript thanks a lot! the only reason I didnt change anything because they said don't change the code above the line when you had to change what is being returned smh.
CamperBot
@camperbot
May 01 2016 02:00
freshsteak sends brownie points to @ndburrus and @radascript :sparkles: :thumbsup: :sparkles:
:warning: freshsteak already gave radascript points
:star: 291 | @ndburrus | http://www.freecodecamp.com/ndburrus
EricOber
@EricOber
May 01 2016 02:01
i put that in there, as well as changed the "2016" string to just 2016, still getting a SyntaxError: Unexpected Token {
Jamie C
@jamiec92
May 01 2016 02:01

function convertToF(celsius) {
// Only change code below this line

// Only change code above this line
return fahrenheit;
}

// Change the inputs below to test your code
convertToF(30);

Mike Olie
@SwiftMike
May 01 2016 02:01
@ndburrus it worked
@ndburrus do you know an alternative?
rphares
@rphares
May 01 2016 02:01
@Am3ricanPaladin , check the punctuation--
what is in an array, in-between stuff, that isn't in yours, in between stuff?
EricOber
@EricOber
May 01 2016 02:02
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }

  {
    "artist": "Hometown Band",
    "title": "Garage Rock",
    "release_year": 2016,
    "formats": [
      "CS",
      "8T",
      "LP",
      "MP3"],
      "gold": true
  }
    ];
Norvin Burrus
@ndburrus
May 01 2016 02:02

@FreshSteak actually, you can comply with the directions... see example...

js
<// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

    var lookup = {
    "alpha":"Adams",
    "bravo":"Boston",
    "charlie":"Chicago",
    "delta":"Denver",
    "echo":"Easy",
    "foxtrot":"Frank",
  };

  result = lookup[val];

  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("charlie");
>

You're on fire! :smile:

rphares
@rphares
May 01 2016 02:02
(i think is the hint that the lovely @ndburrus was giving... :blush: )
Norvin Burrus
@ndburrus
May 01 2016 02:02
@rphares thanx!! creative, no?
CamperBot
@camperbot
May 01 2016 02:02
ndburrus sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 4278 | @rphares | http://www.freecodecamp.com/rphares
EricOber
@EricOber
May 01 2016 02:03
hmmm
Vivek
@vivek28111992
May 01 2016 02:03
@rphares hi
Norvin Burrus
@ndburrus
May 01 2016 02:03
@Am3ricanPaladin how are you doing?
rphares
@rphares
May 01 2016 02:04
indeed, I'm impressed--on that one i usually just resort to 'you forgot an X', Imma steal your prompt for next time that one comes up! Thanks, @ndburrus
CamperBot
@camperbot
May 01 2016 02:04
rphares sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star: 292 | @ndburrus | http://www.freecodecamp.com/ndburrus
EricOber
@EricOber
May 01 2016 02:04
posted my most recent code just above. i dont know what to put in between my two JSON objects
Norvin Burrus
@ndburrus
May 01 2016 02:04
@jamiec92 it looks as though a conversion formula will be needed....
@rphares You're the greatest! :sparkles:
rphares
@rphares
May 01 2016 02:05
var array = [11, 23]; @Am3ricanPaladin
how do they separate stuff in the array? you can store anything in one... like var array = ["John", 23];
EricOber
@EricOber
May 01 2016 02:05
hey, how did you come up with that?
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
,
  {
    "artist": "Hometown Band",
    "title": "Garage Rock",
    "release_year": 2016,
    "formats": [
      "CS",
      "8T",
      "LP",
      "MP3"],
      "gold": true
  }
    ];
rphares
@rphares
May 01 2016 02:05
they are just examples-- dont put in those array,
EricOber
@EricOber
May 01 2016 02:06
oh ok
Norvin Burrus
@ndburrus
May 01 2016 02:06
@Am3ricanPaladin it looks like you got it!
rphares
@rphares
May 01 2016 02:06
Awesome! Congrats!
EricOber
@EricOber
May 01 2016 02:06
oh so it was the comma i needed. i didnt realize because the objects were so big
thanks @ndburrus and @rphares
CamperBot
@camperbot
May 01 2016 02:06
am3ricanpaladin sends brownie points to @ndburrus and @rphares :sparkles: :thumbsup: :sparkles:
:star: 293 | @ndburrus | http://www.freecodecamp.com/ndburrus
:star: 4280 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
May 01 2016 02:07
Anytime~ happy coding! :blush:
Norvin Burrus
@ndburrus
May 01 2016 02:07
@Am3ricanPaladin the computer isnt as fallible as we (humans) are. it didnt miss anything.... :)
rphares
@rphares
May 01 2016 02:07
@vivek28111992 , hey!! sorry sorry, too many things at once-- good to see ya! :blush:
EricOber
@EricOber
May 01 2016 02:07
lol
rphares @rphares pops out again, happy to see people being awesome~ :blush:
bitgrower
@bitgrower
May 01 2016 02:08
:wave: @rphares
Norvin Burrus
@ndburrus
May 01 2016 02:08
@Am3ricanPaladin it (the computer) is kind enough to remind you when you overlook something - you can bank on it! :+1:
missNasser
@missNasser
May 01 2016 02:08
so can anyone help me with it
Vivek
@vivek28111992
May 01 2016 02:09
@rphares np :smile:
@bitgrower was that hand wave for hi or bye?
Norvin Burrus
@ndburrus
May 01 2016 02:09
@missNasser which challenge are you working on, please? @jamiec92 How are you doing with that formula?
bitgrower
@bitgrower
May 01 2016 02:09
LOL ... a generic greeting ...
man you're a nosy cuss ... :)
Daniel Reyes
@danjreyes
May 01 2016 02:11
I'm working on the Chunky Monkey challenge and am a little stuck.
Here's my code.
```
function chunkArrayInGroups(arr, size) {
  // Break it up.
  var countArr = arr.length;
  var length = Math.floor(countArr/size);
  var newArr = [[],[]];


  for (var i = 0; i < countArr; i++)
    {


          var a1 = Math.floor((i)/length);
          //var a2 = Math.floor(i-a1)-1;
          //console.log(a1, a2, arr[i]);
          newArr[a1].push(arr[i]);
          //newArr[a1][a2] = arr[i];
          //console.log(a1,arr[i]);

    }
  console.log(newArr);
  return newArr;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
It passes this test "chunkArrayInGroups(["a", "b", "c", "d"], 2) should return [["a", "b"], ["c", "d"]]."
but fails this test "chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3) should return [[0, 1, 2], [3, 4, 5]]."
bitgrower
@bitgrower
May 01 2016 02:13
you need to iterate based on the length of the array, not the length of the "stride" ...
Daniel Reyes
@danjreyes
May 01 2016 02:13
I'm not sure why it fails the second test. I thought this would pass anything with two nested arrays because of how I initialed the newArr variable
missNasser
@missNasser
May 01 2016 02:13
dose anyone know at all how i can make a search batch file that will search my whole computer
Vivek
@vivek28111992
May 01 2016 02:14
@bitgrower too much lol .. are you really laughing out loud , I doubt so?
Daniel Reyes
@danjreyes
May 01 2016 02:14
I'm also confused because when I look at the console it looks like I have it correct for the second test.
bitgrower
@bitgrower
May 01 2016 02:14
not really interested in writing in batch files, @missNasser ... I suspect other folks here feel the same ....
chill @vivek28111992
missNasser
@missNasser
May 01 2016 02:15
@bitgrower I can understand that i am in a javascript chat
Srinivasan
@kksrini89
May 01 2016 02:16
can anyone help me to solve "Seek and Destroy" challenge
function destroyer(arr) {
  // Remove all the values
  for(var i = 0; i < 1; i++){
    if(i !== 0){
      var position = arguments[0].indexOf(arguments[i]);
      if(position !== -1)
        {
          console.log(position);
          arr = arr.splice(position,1);
        }
    }
  }  

  //arr=arr.filter(function(val){    
    //return (val!=arguments[1] || val!=arguments[2]);
  //});
  return arr;
}
bitgrower
@bitgrower
May 01 2016 02:16
one of my favorites, @kksrini89
Srinivasan
@kksrini89
May 01 2016 02:17
then tell me what I did wrong here.
bitgrower
@bitgrower
May 01 2016 02:17
first of all, you need to determine the length of the arguments object to know how many arguments you are dealing with ...
secondly, I don't believe you can use indexOf with the arguments object ... so you want to stick the arguments passed to the function into some local variables...
Srinivasan
@kksrini89
May 01 2016 02:18
ok. then...
bitgrower
@bitgrower
May 01 2016 02:19
in the test cases, they do provide tests with varying #s of arguments ...
Srinivasan
@kksrini89
May 01 2016 02:19
yes. I do see
ultimately, arguments[0] is the initial array right.. then we can use indexOf method???
bitgrower
@bitgrower
May 01 2016 02:21
arguments is NOT an array ... it is array-like ... so, array methods will typically NOT work with the arguments object ....
however. you can do this: arguments.length
Norvin Burrus
@ndburrus
May 01 2016 02:21
@danjreyes ...sre you opting to not use Array.slice?
missNasser
@missNasser
May 01 2016 02:21
@ndburrus I pm you
Jamie C
@jamiec92
May 01 2016 02:22
@ndburrus have no idea mate :(
bitgrower
@bitgrower
May 01 2016 02:22
you also need to know that the value of the arguments object will change with each new context or scope -- so every time you call a function, a new arguments object is created ... referenced via the arguments variable
Javier
@sh1g
May 01 2016 02:23
hitting my head against the wall. I want to check if the item in arr[0] == (arr[1] - 1)
when the array is a made up of sequential numbers
bitgrower
@bitgrower
May 01 2016 02:23
what types are in arr[0] and arr1 ?
Norvin Burrus
@ndburrus
May 01 2016 02:24
@jamie - are you doing the temp conversion? i forgot...
Srinivasan
@kksrini89
May 01 2016 02:24
a new copy of arguments object only will be created so the previous one will not get affected right?
Norvin Burrus
@ndburrus
May 01 2016 02:24
@dan are*
Jamie C
@jamiec92
May 01 2016 02:24
@ndburrus yeah bud.
bitgrower
@bitgrower
May 01 2016 02:24
as long as you are in the same scope, @kksrini89
Javier
@sh1g
May 01 2016 02:24
so if arr = [1,2,3,4] then it should be true if it's in a loop and false if it's something like arr = [1, 3, 4]
Norvin Burrus
@ndburrus
May 01 2016 02:24
@danjreyes are*
Srinivasan
@kksrini89
May 01 2016 02:25
ok @bitgrower now I try with your shared knowledge. will see
Jamie C
@jamiec92
May 01 2016 02:25
@ndburrus just getting confused lol
Srinivasan
@kksrini89
May 01 2016 02:25
@bitgrower thank you.
CamperBot
@camperbot
May 01 2016 02:25
kksrini89 sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 1024 | @bitgrower | http://www.freecodecamp.com/bitgrower
bitgrower
@bitgrower
May 01 2016 02:25
yw .... :)
Blake Harris
@bharris62
May 01 2016 02:26
quick question, I am working on random quote generator, and I am not understanding how to save both the quote and author from (my own) JSON object from the randomly selected one.
var randomQuote = quotes[Math.floor(Math.random() * quotes.length + 1)];
Bobby McDonald
@BobbyMcWho
May 01 2016 02:28
Are you using your own quotes or an API?
Blake Harris
@bharris62
May 01 2016 02:28
myown
a sample would look like this.
Robert Richey
@0x0936
May 01 2016 02:28
@bharris62 don't add 1 at the end
Blake Harris
@bharris62
May 01 2016 02:28
var quotes = [
  {'author':'Alice Roosevelt Longworth', 'quote':"If you haven't got anything nice to say about anybody, come sit next to me."}
]
if I don't add one, i never get the last quote in the JSON
Bobby McDonald
@BobbyMcWho
May 01 2016 02:30
quotes.author quotes.quote
Dylan
@dhcodes
May 01 2016 02:30
@bharris62 since your quotes are stored in an object, you will need to access teh object within the array
Toni Shortsleeve
@KoniKodes
May 01 2016 02:30
@Radascript Thank you. I was making it too complicated.
CamperBot
@camperbot
May 01 2016 02:30
konikodes sends brownie points to @radascript :sparkles: :thumbsup: :sparkles:
:star: 335 | @radascript | http://www.freecodecamp.com/radascript
Dylan
@dhcodes
May 01 2016 02:30
I'm not sure you need to wrap it all in an array @bharris62
Blake Harris
@bharris62
May 01 2016 02:30
I was doing that earlier, and it was mismatching authors and quotes
Norvin Burrus
@ndburrus
May 01 2016 02:31
@jamiec92 how is the formula coming along - can you post?
Bobby McDonald
@BobbyMcWho
May 01 2016 02:33

If you have

var quotes = [ {'author':'Alice Roosevelt Longworth', 'quote':"If you haven't got anything nice to say about anybody, come sit next to me."}]

and you call

console.log(quotes.author + " " + quotes.quote);

What do you get

Jamie C
@jamiec92
May 01 2016 02:33
@ndburrus i havent writ anything down lol

function convertToF(celsius) {
// Only change code below this line

// Only change code above this line
return fahrenheit;
}

// Change the inputs below to test your code
convertToF(30);

Norvin Burrus
@ndburrus
May 01 2016 02:33
@jamiec92 ok, moment...
Blake Harris
@bharris62
May 01 2016 02:34
I know how to access like that @BobbyMcWho the issue was coming when I was randomly selecting them
but ,what I have done which seems to work is.
onclick = function newQuote(){
  var randomQuote = quotes[Math.floor(Math.random() * quotes.length + 1)];


  console.log(randomQuote.author + randomQuote.quote);
Dheeraj Kumar Dhall
@dheerajdhall27
May 01 2016 02:35
Hello! How would i go about using regex to match a complete string. any specific function?
Diego Mayer
@Chrono79
May 01 2016 02:36
@dheerajdhall27 paste an example
you could use the literal word, with boundaries
if its a whole string you want to match, use ^pattern$
Dheeraj Kumar Dhall
@dheerajdhall27
May 01 2016 02:36
/[0-9]{1}\s?(?[0-9]{3})?\s?|-?[0-9]{3}\s?|-?[0-9]{4}/ this is my regex for US phone numbers
doesn't work
Norvin Burrus
@ndburrus
May 01 2016 02:37
@jamiec92 ok, basically the formula is already given information. the instructions offer that we need to create a "Fahrenheit " variable - can u do that?
Diego Mayer
@Chrono79
May 01 2016 02:38
@dheerajdhall27 you migth want to escape some ( and )
Norvin Burrus
@ndburrus
May 01 2016 02:38
@jamiec92 how can we create a var/iable?
EricOber
@EricOber
May 01 2016 02:38
can someone help me with me code again? lol
// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

// Only change code below this line
myStorage.car.inside["glove box"];
var gloveBoxContents = "maps"; // Change this line
Norvin Burrus
@ndburrus
May 01 2016 02:39
@Am3ricanPaladin ...always a pleasure... go! :)
EricOber
@EricOber
May 01 2016 02:39
thank you sir
Dheeraj Kumar Dhall
@dheerajdhall27
May 01 2016 02:39
@Chrono79 is there any online tutorial or article to understand regex
its pretty confusing
Diego Mayer
@Chrono79
May 01 2016 02:39
help regex
CamperBot
@camperbot
May 01 2016 02:39

:point_right: js regex resources [wiki]

Links to useful RegEx resources.

See also: :clipboard: Tutorials | :syringe: Testing | :soccer: Games | :newspaper: Blogs | :package: Software

:pencil: read more about js regex resources on the FCC Wiki

Norvin Burrus
@ndburrus
May 01 2016 02:39
@Am3ricanPaladin which challenge, please?
EricOber
@EricOber
May 01 2016 02:39
it is the Accessing Nested Objects in JSON
Robert Richey
@0x0936
May 01 2016 02:41
@bharris62 here is an example
var quotes = [
  { author: 'bob', quote: 'Hello' },
  { author: 'sally', quote: 'World' }
];

// quotes length === 2

// Math.random() generates a random floating point value 0 - 0.999~
// multiplied by 2 gives a range of 0 - 1.999~
// floored gives a range of 0 - 1

var randomIndex = Math.floor(Math.random() * quotes.length);

var randomQuote = quotes[randomIndex];
Norvin Burrus
@ndburrus
May 01 2016 02:41
@Am3ricanPaladin ok, basically, we're trying to drill down into the json object to pull out information...
EricOber
@EricOber
May 01 2016 02:41
right
Srinivasan
@kksrini89
May 01 2016 02:41
@bitgrower your knowledge helped me...I solved that
EricOber
@EricOber
May 01 2016 02:42
i thought i did that with my code, but i guess not
// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

// Only change code below this line
myStorage.car.inside["glove box"];
var gloveBoxContents = "maps"; // Change this line
Jamie C
@jamiec92
May 01 2016 02:43
@ndburrus I know how to do that. var fahrenheit right?
Blake Harris
@bharris62
May 01 2016 02:43
thanks @0x0936
CamperBot
@camperbot
May 01 2016 02:43
bharris62 sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:star: 1293 | @0x0936 | http://www.freecodecamp.com/0x0936
Norvin Burrus
@ndburrus
May 01 2016 02:43
@Am3ricanPaladin ok, you're on the right track.... you can access the property, using an assignment to the variable (gloveBoxContents) you created....
Dheeraj Kumar Dhall
@dheerajdhall27
May 01 2016 02:43
@camperbot thank you
CamperBot
@camperbot
May 01 2016 02:43
dheerajdhall27 sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 1636 | @camperbot | http://www.freecodecamp.com/camperbot
Dheeraj Kumar Dhall
@dheerajdhall27
May 01 2016 02:43
@Chrono79 thank you
EricOber
@EricOber
May 01 2016 02:44
oh ok, so i will delete myStorage.car.inside["glove box"]; first
Norvin Burrus
@ndburrus
May 01 2016 02:44
@jamiec92 right! ... now, we need to assign the variable to the formula given...
@Am3ricanPaladin
@Am3ricanPaladin hold your horses... no delete
EricOber
@EricOber
May 01 2016 02:45
roger
Norvin Burrus
@ndburrus
May 01 2016 02:45
@Am3ricanPaladin assign what youve got to your variable
@Am3ricanPaladin hint:
js
<var gloveBoxContents =>
EricOber
@EricOber
May 01 2016 02:46
ah
Norvin Burrus
@ndburrus
May 01 2016 02:46
@Am3ricanPaladin does this make sense?
EricOber
@EricOber
May 01 2016 02:47
little by little it is

var gloveBoxContents = "maps"; // Change this line
var gloveboxcontents = myStorage.car.inside["glove box"];
Norvin Burrus
@ndburrus
May 01 2016 02:48
@Am3ricanPaladin it should make sense once you see the result.... youre simply reaching into (level, by level) the object to retrieve information (a property)
@Am3ricanPaladin woohoo! is that it?
EricOber
@EricOber
May 01 2016 02:49
first I am pointing to "maps" to define it, then I am pointing to the route to where "maps" is.
Norvin Burrus
@ndburrus
May 01 2016 02:49
@Am3ricanPaladin hey, what's the attraction to that "maps" ?
@Am3ricanPaladin the "glove box" will lead you to the desired result
EricOber
@EricOber
May 01 2016 02:50
so i can define the same variable over and over again?
Norvin Burrus
@ndburrus
May 01 2016 02:50
@Am3ricanPaladin maps is the result - use the code to get the result
@Am3ricanPaladin hint - delete the maps line
@Am3ricanPaladin then test code
brb in a few minutes
Abdul Awali
@awalthefirst
May 01 2016 02:51
This message was deleted
EricOber
@EricOber
May 01 2016 02:51
it comes up as gloveBoxContents = BLANK
var gloveBoxContents = ""; // Change this line
var gloveboxcontents = myStorage.car.inside["glove box"];
Norvin Burrus
@ndburrus
May 01 2016 02:51
@jamiec92
js
<function convert(celsius) {
  // Only change code below this line
  var fahrenheit = celsius * 9.0/5.0 + 32;

  // Only change code above this line
  if ( typeof fahrenheit !== 'undefined' ) {
    return fahrenheit;
  } else {
    return 'fahrenheit not defined';
  }
}

// Change the inputs below to test your code
convert(30);
>
Jeff
@meankraken
May 01 2016 02:52
Hey everyone.. I'm working on the react projects and want to import redux-promise as a middleware... can anyone explain to me how I would do this?
Chase Webb
@jerrybaggin
May 01 2016 02:52
question fellas! in the Confirm the Ending Challenge im supposed to use the substr() method. cool, I believe I understand how it works. My question is inside the parenthesis ( str.length, what do I put here ) . im not sure how to get the last index of each string.
Norvin Burrus
@ndburrus
May 01 2016 02:52
@Am3ricanPaladin
js
<// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

// Only change code below this line

var gloveBoxContents = myStorage.car.inside["glove box"]; // Change this line

>
brb
EricOber
@EricOber
May 01 2016 02:54
ok
ah ha, i see what you did there now
thanks @ndburrus
CamperBot
@camperbot
May 01 2016 02:55
am3ricanpaladin sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:warning: am3ricanpaladin already gave ndburrus points
Jamie C
@jamiec92
May 01 2016 02:56
@ndburrus jeez i am so thick , i kept putting brackets around the celsius ahaha
@ndburrus thanks so much for the help
CamperBot
@camperbot
May 01 2016 02:57
jamiec92 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star: 294 | @ndburrus | http://www.freecodecamp.com/ndburrus
Mike Olie
@SwiftMike
May 01 2016 02:59
question
how do i return an undefined variable on the Return Early Pattern for Functions
```
// Setup
function abTest(a, b) {
  // Only change code below this line

  if (a < 0 || b < 0){
    return true;
  }
  // Only change code above this line

  return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

// Change values below to test your code
abTest(2,2);
Robert
@Brayn7
May 01 2016 03:00

if there a better way for this?
function diffArray(arr1, arr2) {
var newArr = [];
// Same, same; but different.
for (var i = 0; i < arr2.length; i++){
if (arr1.indexOf(arr2[i]) === -1){
newArr.push(arr2[i]);
}
}

for (var j = 0; j < arr1.length; j++){
if (arr2.indexOf(arr1[j]) === -1){
newArr.push(arr1[j]);
}
}
return newArr;
}

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

diff two arrays challenge

obviously there is since im practically repeating my code twice
Yaroslav Newman
@YaroNew
May 01 2016 03:01
hi guys
Robert
@Brayn7
May 01 2016 03:01
@YaroNew hey man
Yaroslav Newman
@YaroNew
May 01 2016 03:01
i can't get assingment with farenheit
i manage to calculate 2 variables but not all
Diego Mayer
@Chrono79
May 01 2016 03:03
@Brayn7 you could concat and apply a filter function
Yaroslav Newman
@YaroNew
May 01 2016 03:03
concat
Robert
@Brayn7
May 01 2016 03:03
@YaroNew celsius * 1.8 + 32 is fahrenheit
Yaroslav Newman
@YaroNew
May 01 2016 03:04
@Brayn7 I know
Robert
@Brayn7
May 01 2016 03:04
@Chrono79 i wanted to but couldnt think how to do it
@Chrono79 set me on the correct path please
Yaroslav Newman
@YaroNew
May 01 2016 03:04
@Brayn7 but I need to make function convertion for number of vairables
Diego Mayer
@Chrono79
May 01 2016 03:05
@Brayn7 concat will give you a new array with the elements of both arrays
Compare two arrays and return a new array with any items only found in one of the two given arrays, but not both. In other words, return the symmetric difference of the two arrays.
So your filter function should ask if the elements in your new array is not in the first or the second array (your function params).
Robert
@Brayn7
May 01 2016 03:05
@YaroNew are you trying to complete Convert Celsius to Fahrenheit challenge?
Yaroslav Newman
@YaroNew
May 01 2016 03:05
@Brayn7 Yup

function convertToF(celsius) {
// Only change code below this line

// Only change code above this line
return fahrenheit;
}

// Change the inputs below to test your code
convertToF(30);

Robert
@Brayn7
May 01 2016 03:06
@YaroNew in function just return the arg with the math applied to it
Yaroslav Newman
@YaroNew
May 01 2016 03:06

function convertToF(celsius) {
// Only change code below this line
var fahrenheit = -10*9/5+32;

// Only change code above this line
return fahrenheit;
}

// Change the inputs below to test your code
convertToF(30);

convertToF(-30) should return a value of -22
convertToF(-10) should return a value of 14
convertToF(0) should return a value of 32
convertToF(20) should return a value of 68
convertToF(30) should return a value of 86
Mateusz Szymański
@matszym
May 01 2016 03:07
@YaroNew You hsould have used celsius variable, atm no matter what imput you get you will get the same utput
Robert
@Brayn7
May 01 2016 03:07
@YaroNew but your are not taking the argument "celsius" and applying the math to it
Dylan
@dhcodes
May 01 2016 03:07
@YaroNew instead of -10 in your code, use the celsius var they give you
Yaroslav Newman
@YaroNew
May 01 2016 03:08
done )
thanks
EricOber
@EricOber
May 01 2016 03:08
// Setup
var myPlants = [
  { 
    type: "flowers",
    list: [
      "rose",
      "tulip",
      "dandelion"
    ]
  },
  {
    type: "trees",
    list: [
      "fir",
      "pine",
      "birch"
    ]
  }  
];

// Only change code below this line

var secondTree = myPlants[1].names[1];
this make sense to anyone?
Yaroslav Newman
@YaroNew
May 01 2016 03:09
@dhcodes thx man
CamperBot
@camperbot
May 01 2016 03:09
yaronew sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star: 720 | @dhcodes | http://www.freecodecamp.com/dhcodes
Dylan
@dhcodes
May 01 2016 03:09
@Am3ricanPaladin nothing is named names in the object
Mateusz Szymański
@matszym
May 01 2016 03:09

@Am3ricanPaladin

names[1];

this doesnt

EricOber
@EricOber
May 01 2016 03:09
oh i just got it, instead of names i should have puts lists
Dylan
@dhcodes
May 01 2016 03:09
cool
EricOber
@EricOber
May 01 2016 03:09
thanks @dhcodes and @matszym
CamperBot
@camperbot
May 01 2016 03:09
am3ricanpaladin sends brownie points to @dhcodes and @matszym :sparkles: :thumbsup: :sparkles:
:star: 721 | @dhcodes | http://www.freecodecamp.com/dhcodes
:star: 25 | @matszym | http://www.freecodecamp.com/matszym
Robert
@Brayn7
May 01 2016 03:13
@Chrono79 thanks ill give it another shot later
CamperBot
@camperbot
May 01 2016 03:13
brayn7 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star: 574 | @chrono79 | http://www.freecodecamp.com/chrono79
Norvin Burrus
@ndburrus
May 01 2016 03:15
@Am3ricanPaladin Great work!! :sparkles: @jamiec92 Super!!! :fire:
Dennis Niemeijer
@daniemeijer
May 01 2016 03:17
kinda stuck on #220 outcome is what is should be, but i don't get an ok! Help please?
Norvin Burrus
@ndburrus
May 01 2016 03:18
@daniemeijer which one is 220?
Dennis Niemeijer
@daniemeijer
May 01 2016 03:20
its called record collection
Norvin Burrus
@ndburrus
May 01 2016 03:21
@daniemeijer ok, where are you - can you post what youve got so far?
Mateusz Szymański
@matszym
May 01 2016 03:21
help record collection
CamperBot
@camperbot
May 01 2016 03:21

:point_right: challenge record collection [wiki]

Checkpoint: Record Collection

Instructions

You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number and has several properties. Not all albums have complete information.

Write a function which takes an id, a property (prop), and a value.

For the given id in collection:

If value is non-blank (value !== ""), then update or set the value for the prop.

If the prop is "tracks" and value is non-blank, push the value onto the end of the tracks array.

If value is blank, delete that prop.

Always return the entire collection object.

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

:pencil: read more about challenge record collection on the FCC Wiki

Abdul Awali
@awalthefirst
May 01 2016 03:23
Celsius to Fahrenheit in A pure JavaScript way
(c=>c*(Math.pow((true+true+true),(true+true))/
(true+true+true+true+true))+
Math.pow((true+true),Math.pow((true+true),(true+true))+true))(30)
Norvin Burrus
@ndburrus
May 01 2016 03:25
@daniemeijer help format code
help format code
CamperBot
@camperbot
May 01 2016 03:25
no wiki entry for: format code
Norvin Burrus
@ndburrus
May 01 2016 03:25
help post code
CamperBot
@camperbot
May 01 2016 03:25
Norvin Burrus
@ndburrus
May 01 2016 03:25
help paste code
CamperBot
@camperbot
May 01 2016 03:25
no wiki entry for: paste code
Rada
@Radascript
May 01 2016 03:26
help format
CamperBot
@camperbot
May 01 2016 03:26

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

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

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

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

Norvin Burrus
@ndburrus
May 01 2016 03:26
@Radascript that's it....
any questions?
Dennis Niemeijer
@daniemeijer
May 01 2016 03:35
<test
<test>
```
<test
storbeck
@storbeck
May 01 2016 03:35
why do people keep thanking me for things in this channel? i dont get it
Norvin Burrus
@ndburrus
May 01 2016 03:36
@daniemeijer that's it.... :+1:
@daniemeijer you may find the compose @ chat buttons to the right of the chat area useful also...
Dennis Niemeijer
@daniemeijer
May 01 2016 03:37
we'll get there! :-)
Norvin Burrus
@ndburrus
May 01 2016 03:37
@daniemeijer ..no doubt about it...
storbeck
@storbeck
May 01 2016 03:38
Diego Mayer
@Chrono79
May 01 2016 03:38
@storbeck maybe you've written something in the fcc's wiki?
storbeck
@storbeck
May 01 2016 03:38
i don't think so
Joseph
@revisualize
May 01 2016 03:40
@storbeck You're just awesome?
storbeck
@storbeck
May 01 2016 03:40
i guess so
Joseph
@revisualize
May 01 2016 03:40
@storbeck You're helping people even when you're not here!
Norvin Burrus
@ndburrus
May 01 2016 03:41
@revisualize ...and modest, he is.... :sparkles:
storbeck
@storbeck
May 01 2016 03:41
they dont think it be like it is but it do
dontchaknow
@dontchaknow
May 01 2016 03:53
str[i][0].toUpperCase()
function titleCase(str) {
    str = str.toLowerCase().split(" ");
    for (var i = 0; i < str.length; i++) {
        str[i][0].toUpperCase();
    }
    return str[1][0].toUpperCase();
}
I'm expecting to return an array where the first letter is capitalized but it doesnt happen.
oops that last line should be return str
Norvin Burrus
@ndburrus
May 01 2016 03:54
@dontchaknow what is the1 for?
@dontchaknow "1"
dontchaknow
@dontchaknow
May 01 2016 03:55
I was just testing the toUpperCase() method on a specific iteration
manually
the last line should be return str;
function titleCase(str) {
    str = str.toLowerCase().split(" ");
    for (var i = 0; i < str.length; i++) {
        str[i][0].toUpperCase();
    }
    return str;
}
storbeck
@storbeck
May 01 2016 03:55
@dontchaknow strings are immutable
dontchaknow
@dontchaknow
May 01 2016 03:55
oops
oh
hmm not sure where to go from here
i dont want to look at the answer
storbeck
@storbeck
May 01 2016 03:58
well you have one specific line you need to change
str[i][0].toUpperCase();
you need to replace str[i] - you can not modify it
you can replace the entire string but not individual characters
Rada
@Radascript
May 01 2016 03:59
@storbeck he is trying to turn string into array wiht the split
storbeck
@storbeck
May 01 2016 03:59
yes i am aware
Rada
@Radascript
May 01 2016 03:59
@dontchaknow I think you just need a different name for your array
storbeck
@storbeck
May 01 2016 03:59
no
Rada
@Radascript
May 01 2016 03:59
so go like
var arr = str.split("")
and then play with array instead of string
that one you can manually change every element
storbeck
@storbeck
May 01 2016 04:00
that's over complicating it
Rada
@Radascript
May 01 2016 04:00
@storbeck well that's the route he is taking, it'll work
storbeck
@storbeck
May 01 2016 04:01
or he could just do what he's doing + splice and overwrite str[i]
so you don't need to transform between data types
Rada
@Radascript
May 01 2016 04:02
@storbeck yeah that works too. To me the other way follows more intuitively despite being less elegant / adding an unneccesary variable
dontchaknow
@dontchaknow
May 01 2016 04:03
im a sucker for elegance
storbeck
@storbeck
May 01 2016 04:03
ok
Rada
@Radascript
May 01 2016 04:03
either way @dontchaknow there you got two solutions :D
dontchaknow
@dontchaknow
May 01 2016 04:03
let me think about it some more. i appreciate the hints.
Rada
@Radascript
May 01 2016 04:04
@dontchaknow well Geoff's solution uses splice() and avoids introducing an extra var, which is good practice to save memory. Mine requires a little less modification of your code
Robert
@Brayn7
May 01 2016 04:05

@Chrono79 is this better yo?

function diffArray(arr1, arr2) {
var newArr = arr1.concat(arr2);

return newArr.filter(function(a){
return arr1.indexOf(a) === -1 || arr2.indexOf(a) === -1;
});

}

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

i like this alot more
thanks again
Chris Cullen
@123xylem
May 01 2016 04:08
help chunkey monkey
CamperBot
@camperbot
May 01 2016 04:08
no wiki entry for: chunkey monkey
Chris Cullen
@123xylem
May 01 2016 04:08
help chunky monkey
CamperBot
@camperbot
May 01 2016 04:08

:point_right: algorithm chunky monkey [wiki]

Explanation

Our goal for this Algorithm is to split arr (first argument) into smaller chunks of arrays with the length provided by size (second argument). There are 4 green checks (objectives) our code needs to pass in order to complete this Algorithm:

  1. (['a', 'b', 'c', 'd'], 2) is expected to be [['a', 'b'], ['c', 'd']]
  2. ([0, 1, 2, 3, 4, 5], 3) is expected to be [[0, 1, 2], [3, 4, 5]]
  3. ([0, 1, 2, 3, 4, 5], 2) is expected to be [[0, 1], [2, 3], [4, 5]]
  4. ([0, 1, 2, 3, 4, 5], 4) is expected to be [[0, 1, 2, 3], [4, 5]]

Click More information under the Algorithm title and read the helpful links if you haven't yet.

:pencil: read more about algorithm chunky monkey on the FCC Wiki

DJ
@qualitymanifest
May 01 2016 04:09
@Brayn7 haha, that's essentially idential to my solution. only difference was the parameter name in the filter function
Robert
@Brayn7
May 01 2016 04:11
@qualitymanifest nice. for some reason that one made me hafta think a little more.
Dheeraj Kumar Dhall
@dheerajdhall27
May 01 2016 04:20
Hello (([a-z]+)(.|+)?([a-z]+)?)((+)?[a-z]+)?(\@[a-z]+)(.[a-z]+)?(.[a-z]+)?
this is an email validation regex i wrote
could it be done better?
Thomas Hodges
@thodges314
May 01 2016 04:23
Does anyone know how to define and use a variable in the global scope in javascript? It doesn't seem to be working no matter how I tried.
I have tried: a) defining "var varName;" outside of all the functions and then changing the value of the var within functions
b) skipping that and using vars without declaring them inside of functions.
c) assigning values to window.varName from within functions.
Chris Cullen
@123xylem
May 01 2016 04:23
Can I just ask how quickly YOU can work this function to make it print an array split into sub arrays of size (size).?? I struggled with the logic on this one and just wondered how fast yall could answer it?
function chunkArrayInGroups(arr, size) {
  // Break it up.
  return arr;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
Just trying to see where my logic skill is vs coding syntax knowledge
DJ
@qualitymanifest
May 01 2016 04:33
@123xylem no reason you should worry about how fast someone else could do it. just keep going
rphares
@rphares
May 01 2016 04:37
lol, hiya, @bitgrower ! :)
Michael Karpinski
@karpimpski
May 01 2016 04:38
anybody here know anything about Ruby, or any other language, really, but I'm using Ruby right now
wow that was a run-on, but you guys get the point
Marek Slabicki
@thaniri
May 01 2016 04:43
hey has anyone here done HackerRank challenges using javascript before?
Michael Karpinski
@karpimpski
May 01 2016 04:45
@thaniri hey, thanks for the link! never heard of it
CamperBot
@camperbot
May 01 2016 04:45
karpimpski sends brownie points to @thaniri :sparkles: :thumbsup: :sparkles:
:star: 201 | @thaniri | http://www.freecodecamp.com/thaniri
Chris Cullen
@123xylem
May 01 2016 04:45

Hi guys what does "i+= size" mean or do in this situation???

size =3; (var i = 0; i < arr.length; i += size)

Marek Slabicki
@thaniri
May 01 2016 04:46
looks like i increases by 3
Chris Cullen
@123xylem
May 01 2016 04:46
does it iterate 3 times?
Michael Karpinski
@karpimpski
May 01 2016 04:46
@123xylem is that supposed to be something like this?
size = 3;
for(var i = 0; i < arr.length; i += size)
Chris Cullen
@123xylem
May 01 2016 04:46
yes
Michael Karpinski
@karpimpski
May 01 2016 04:47
@123xylem every time the loop is run it increases the size by the variable size
in this case by 3, until it reaches the array length
Chris Cullen
@123xylem
May 01 2016 04:47
so size becomes 9 on 3 loops?
Michael Karpinski
@karpimpski
May 01 2016 04:47
@123xylem i think it would be after 2 loops, because it starts at 3
@123xylem oh no it's 3 loops, yeah
sorry i'm stupid
Chris Cullen
@123xylem
May 01 2016 04:50
:smile:
var i = 0; i < arr.length; i += size)
The loop starts at element 0, loops once then i += 2 which is another way of stating i = i + 2 so now the new value of i becomes 2. What happens if we combine the following arr.slice() with the for loop?
Daniel Lao
@danielwowsb
May 01 2016 04:51
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i = 0; i < contacts.length; i++){
if(contacts[i][firstName] === firstName && contacts[i][prop]){
return contacts[i][prop];
}
}
}
Michael Karpinski
@karpimpski
May 01 2016 04:51
@123xylem what do you mean? what parameters would you put in the slice?
Daniel Lao
@danielwowsb
May 01 2016 04:51
can anyone explain why my if statement won't evaluate to true
Chris Cullen
@123xylem
May 01 2016 04:52
I think its just saying I has a value of size when applied to an a array.. EG js arr = [1,2,3,4] ;
Michael Karpinski
@karpimpski
May 01 2016 04:52
@danielwowsb could you link me the challenge?
Daniel Lao
@danielwowsb
May 01 2016 04:52
it is the profile lookup in Basic Javascript
Chris Cullen
@123xylem
May 01 2016 04:53
arr =[1,2,3,4];
size= 2;
for (var i = 0; i < arr.length; i += size)
This would give 1,2 3,4?
Michael Karpinski
@karpimpski
May 01 2016 04:54
@123xylem what does the rest of your for loop look like?
@danielwowsb let me solve it quick and I'll get back to you
Chris Cullen
@123xylem
May 01 2016 04:54
because the size of i is 2
Michael Karpinski
@karpimpski
May 01 2016 04:55
@danielwowsb the problem is in your if statement
Chris Cullen
@123xylem
May 01 2016 04:55
i had to read hints of an answer to the solution... But I didnt understand what the forloop meant
Michael Karpinski
@karpimpski
May 01 2016 04:56
in bracket notation, you need to put the EXACT thing from your object. it needs to be ["firstName"], not [firstName]
it would be better to use dot notation in this, but to each his own
Daniel Lao
@danielwowsb
May 01 2016 04:57
@karpimpski when i'm passing in firstName, the argument should be evaluated to "name" though?
@karpimpski for instance:
lookUpProfile("Akira", "likes");
Michael Karpinski
@karpimpski
May 01 2016 04:58
@danielwowsb yeah, you should see if firstName is equal to "firstName"
Daniel Lao
@danielwowsb
May 01 2016 04:58
@karpimpski I know my if statement is the issue, because when I use PythonTutor as my compiler I see nothing entering the if statement
Michael Karpinski
@karpimpski
May 01 2016 04:59
@danielwowsb the issue is how you're defining your object's "firstName"
Eldar Tinjić
@EldarT90
May 01 2016 04:59
why is my vertical alignment not working
in any way i put it
Michael Karpinski
@karpimpski
May 01 2016 05:00
@danielwowsb you need to either use if(contacts[i]["firstName"] === firstName && contacts[i][prop])
or if(contacts[i].firstName === firstName && contacts[i][prop])
D.Mills
@millsdee74
May 01 2016 05:00
@pjstol thanks for the help with Make Object Properties Private
CamperBot
@camperbot
May 01 2016 05:00
millsdee74 sends brownie points to @pjstol :sparkles: :thumbsup: :sparkles:
:star: 194 | @pjstol | http://www.freecodecamp.com/pjstol
Daniel Lao
@danielwowsb
May 01 2016 05:01

ohh i see what you mean, they are not equal if i have contacts[i][firstName] === firstName

@karpimpski

Michael Karpinski
@karpimpski
May 01 2016 05:03
@danielwowsb yeah, if you use bracket notation you need to use exactly what is in the object. if the object has quotations, you need to have quotations
Daniel Lao
@danielwowsb
May 01 2016 05:03
@karpimpski Thanks Michael
CamperBot
@camperbot
May 01 2016 05:03
danielwowsb sends brownie points to @karpimpski :sparkles: :thumbsup: :sparkles:
:star: 355 | @karpimpski | http://www.freecodecamp.com/karpimpski
Randall Fine
@randallfine
May 01 2016 05:04

So..ya. I totally fell on my face with this one function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i = 0; i < arr.length; i++){
for (var j = 0; j < arr[i].length; j++){
for (var k = 0; k < arr[i][j].length; k++){
product *= arr[i][j][k];
}
}
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

Michael Karpinski
@karpimpski
May 01 2016 05:04
@Randallfine format help
@Randallfine help format
help format
CamperBot
@camperbot
May 01 2016 05:04

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

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

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

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

Michael Karpinski
@karpimpski
May 01 2016 05:04
there we go
Randall Fine
@randallfine
May 01 2016 05:04
my bad. first time using chat
Michael Karpinski
@karpimpski
May 01 2016 05:05
@Randallfine no problem! it just makes it easier to review you code if you format it right
your*
@karpimpski could you do that so I can see your code better?
@Randallfine
Daniel Lao
@danielwowsb
May 01 2016 05:07
@Randallfine for(var i = 0; i < arr.length; i++){
for(var j = 0; j < arr[i]; j++){
product *= arr[i][j];
Michael Karpinski
@karpimpski
May 01 2016 05:08
@danielwowsb
help format
CamperBot
@camperbot
May 01 2016 05:08

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

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

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

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

Daniel Lao
@danielwowsb
May 01 2016 05:08
@karpimpski sorry lol
Michael Karpinski
@karpimpski
May 01 2016 05:09
@danielwowsb no problem, it's just easier to read that way!
Daniel Lao
@danielwowsb
May 01 2016 05:09
function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for(var i = 0; i < arr.length; i++){
for(var j = 0; j < arr[i].length; j++){
product *= arr[i][j];
}
}
// Only change code above this line
return product;
}
@Randallfine
Josue Godoy Lechuga
@josue1080
May 01 2016 05:10
Help
CamperBot
@camperbot
May 01 2016 05:10

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
  • Algorithm BONFIRENAME info on a Algorithm

:speech_balloon: meet CamperBot in this room!

:pencil: read more about camperbot on the FCC Wiki

Josue Godoy Lechuga
@josue1080
May 01 2016 05:10
Help Reverse a String
CamperBot
@camperbot
May 01 2016 05:10

:point_right: algorithm reverse a string [wiki]

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :memo:

:checkered_flag: Problem Explanation:

We need to take the string and reverse it, so if it originally reads 'hello', it will now read 'olleh'. We will need to split the string, and therefore we will be working with Arrays as well.

:pencil: read more about algorithm reverse a string on the FCC Wiki

Daniel Lao
@danielwowsb
May 01 2016 05:11
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for(var i = 0; i < arr.length; i++){
    for(var j = 0; j < arr[i].length; j++){
      product *= arr[i][j];
    }
  }
  // Only change code above this line
  return product;
}
@Randallfine loop once through whole array [i], loop again to go through each array within array [j]
Randall Fine
@randallfine
May 01 2016 05:13
Thank you @danielwowsb I was thinking since there were 3 arrays that I needed 3 for loops
CamperBot
@camperbot
May 01 2016 05:13
randallfine sends brownie points to @danielwowsb :sparkles: :thumbsup: :sparkles:
:star: 238 | @danielwowsb | http://www.freecodecamp.com/danielwowsb
Josue Godoy Lechuga
@josue1080
May 01 2016 05:16
Help Factorialize a Number
CamperBot
@camperbot
May 01 2016 05:16

:point_right: algorithm factorialize a number [wiki]

Problem Explanation:

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

Factorials are often represented with the shorthand notation n!

For example: 5! = 1 * 2 * 3 * 4 * 5 = 120

:pencil: read more about algorithm factorialize a number on the FCC Wiki

Josue Godoy Lechuga
@josue1080
May 01 2016 05:20
Help Check for Palindromes
CamperBot
@camperbot
May 01 2016 05:20
no wiki entry for: check for palindromes
Josue Godoy Lechuga
@josue1080
May 01 2016 05:21
HelpCheck for Palindromes
Martialis39
@Martialis39
May 01 2016 06:17
Hey guys, I am doing The Symmetric difference challenge
and I have no idea where to begin :/
Can you give me some basic tips?
Help diff two arrays
CamperBot
@camperbot
May 01 2016 06:20

:point_right: algorithm diff two arrays [wiki]

Explanation:

Check two arrays and return a new array that contains only the items that are not in either of the original arrays.

:pencil: read more about algorithm diff two arrays on the FCC Wiki

Neel Shah
@neelshah22
May 01 2016 06:24
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
  var lookup= {
    alpha: "Adams",

    bravo: "Boston",

    charlie: "Chicago",

    delta: "Denver", 
    echo:  "Easy",
   foxtrot: "Frank",
  };

  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("alpha");
instruction : Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.
can any one help me?
rphares
@rphares
May 01 2016 06:28
Hiya, @neelshah22 ! you've got a good start there,
Neel Shah
@neelshah22
May 01 2016 06:29
can find error in my code?
rphares
@rphares
May 01 2016 06:29
so, lets check out the directions-- something like 'create a table lookup' (which you've done, mostly) and 'use it to lookup val and return the associated string', right?
yes, there are a few steps left--
you've done the first part of those directions,
but not the second part
Neel Shah
@neelshah22
May 01 2016 06:30
ok
rphares
@rphares
May 01 2016 06:30
(also, we usually put the alpha, bravo, charlie stuff in "".... it'll run without, but...)
so, the second part-- there are a few steps, lets talk through them,
first-- we know we will return result, right?
Neel Shah
@neelshah22
May 01 2016 06:31
yes
rphares
@rphares
May 01 2016 06:31
(its below the 'do not change line')
but... right now result = ""
Mike Haslam
@Ongomobile
May 01 2016 06:31
This message was deleted
rphares
@rphares
May 01 2016 06:31
so, after the table, we will want to store the thing we want in result = @neelshah22
so that we have set result to what we want before the return
Next, we need to write what we want... 'use it to lookup val and return the associated string`... let's check the example :blush: @neelshah22
Neel Shah
@neelshah22
May 01 2016 06:32
ok
rphares
@rphares
May 01 2016 06:32
their table is called var alpha and they want to return what is associated with 2, so they write alpha[2]
your table is called?
and you want to return what is associated with ?
Neel Shah
@neelshah22
May 01 2016 06:33
lookup
"alpha"
rphares
@rphares
May 01 2016 06:33
almost--
the first one is correct,
Mike Haslam
@Ongomobile
May 01 2016 06:33
Hello Campers !
I am trying to write a function that checks if elements in array are same,
cant seem to figure out what I am missing, here is my code so far.
var same = ["b", "b,","b"];
 var different = ["b","c","e"];


function isUniform(arr) {
    var isSame = arr[0];
    for(var i = 0; i < arr.length ; i++) {
        if(i !== isSame) {
            return false;
        }
    }
    return true;

}
isUniform(same);
rphares
@rphares
May 01 2016 06:33
but "alpha" is just the test,
'use it to lookup val and return the associated string`
you want to return what is associated with...? @neelshah22
Neel Shah
@neelshah22
May 01 2016 06:34
lookup
z
adamas
sorry
rphares
@rphares
May 01 2016 06:35
lookup is the object, we need object and key,
their table name (their object) is alpha. your table name (your object) is lookup.
they want what is associated with 2, you want what is associated with?
'use it to lookup val and return the associated string`
Neel Shah
@neelshah22
May 01 2016 06:35
lookup["Adams"]
rphares
@rphares
May 01 2016 06:36
"Adams" is just the test...
Neel Shah
@neelshah22
May 01 2016 06:36
lookup["delta"]
rphares
@rphares
May 01 2016 06:36
also just the test--
the "key" is found in this line--
function phoneticLookup(val)
'use it to lookup val and return the associated string`
Martialis39
@Martialis39
May 01 2016 06:37
@Ongomobile Hey man
@Ongomobile looking at it now, one sec
Mike Haslam
@Ongomobile
May 01 2016 06:37
Hey!!!!
@Martialis39 Cool!
Martialis39
@Martialis39
May 01 2016 06:38
@Ongomobile Ok one thing that might be causing an issue
currently, in the same array
the 2nd element is actually "b,"
not "b"
Mike Haslam
@Ongomobile
May 01 2016 06:39
Ok I will change
rphares
@rphares
May 01 2016 06:39
Hmm, anyone around who can explain this more clearly? I'm not good at using the technical words... :pensive:
(he's on Using Objects For Lookups, and he keeps wanting to do result = lookup["stringName"] instead of result = lookup[key] I dont wanna frustrate anyone~
Neel Shah
@neelshah22
May 01 2016 06:40
@rphares I don't understand
Mike Haslam
@Ongomobile
May 01 2016 06:40
@Martialis39 Thanks you have a sharp eye changed that still no joy yet!
CamperBot
@camperbot
May 01 2016 06:40
ongomobile sends brownie points to @martialis39 :sparkles: :thumbsup: :sparkles:
:star: 286 | @martialis39 | http://www.freecodecamp.com/martialis39
rphares
@rphares
May 01 2016 06:40
i know, i was hoping someone who was better at explaining than me would chime in, lol @neelshah22
Neel Shah
@neelshah22
May 01 2016 06:41
. Use it to lookup val and assign the associated string to the result variable.
rphares
@rphares
May 01 2016 06:41
okay-- you see my post asking for help? what you are saying, with "alpha" or "charlie" is hard coding it to check for one specific string
we dont want that,
we want it to lookup val
Martialis39
@Martialis39
May 01 2016 06:41
@Ongomobile Ok I think I got it :)
Look at what you are comparing and really think about it :)
what is "i" and what do you want it to be?
rphares
@rphares
May 01 2016 06:42
val in this case is our key
function phoneticLookup(val) {
Mike Haslam
@Ongomobile
May 01 2016 06:42
I will look
rphares
@rphares
May 01 2016 06:42
(thats your function, @neelshah22 )
so, you can use the table to look it up from your object, lookup and get the associated string,
Martialis39
@Martialis39
May 01 2016 06:43
@Ongomobile hint : you make "i" 0 and few lines before and 0 or 1 or 2 does NOT equal "b" :)
Mike Haslam
@Ongomobile
May 01 2016 06:43
@Martialis39 I tried (arr[i] !== isSame)
rphares
@rphares
May 01 2016 06:43
no matter which "string" (ex "alpha" "charlie" etc) you call @neelshah22
Ankur sharma
@ankur1163
May 01 2016 06:44
@ankur1163
can someone help me convert json to html
this code isnt passing the task
though I see output on right side mobile screen
<script>
  $(document).ready(function() {

    $("#getMessage").on("click", function() {
      $.getJSON("/json/cats.json", function(json) {

        var html = "";
        // Only change code below this line.
        json.map(function(val) {

  // Adding each object keys
  var keys = Object.keys(val);
  // Generating new html
  html += "<div class = 'cat'>";
  // Adding the custom html to each key
  keys.map(function(key) {

    html += "<b>" + key + "</b>: " + val[key] + "<br>";

  });

  html += "</div><br>";

});


        // Only change code above this line.

        $(".message").html(html);

      });
    });
  });
</script>

<div class="container-fluid">
  <div class = "row text-center">
    <h2>Cat Photo Finder</h2>
  </div>
  <div class = "row text-center">
    <div class = "col-xs-12 well message">
      The message will go here
   </div>
  </div>
  <div class = "row text-center">
    <div class = "col-xs-12">
      <button id = "getMessage" class = "btn btn-primary">
        Get Message
      </button>
    </div>
  </div>
</div>
I do see correct id, image link and code names on right side mobile screen
Martialis39
@Martialis39
May 01 2016 06:44
@Ongomobile very good, did it work?
rphares
@rphares
May 01 2016 06:45
i can't explain it well enough, it seems.... really sorry. :pensive: maybe post again-- add the parts you understand from what we talked about, like strong it in result and lookup, and then someone else may take it from there? @neelshah22
Martialis39
@Martialis39
May 01 2016 06:45
it worked for me here
Mike Haslam
@Ongomobile
May 01 2016 06:45
let me try again maybe i did not save
Neel Shah
@neelshah22
May 01 2016 06:45
ok
rphares
@rphares
May 01 2016 06:45
Sorry!
Ankur sharma
@ankur1163
May 01 2016 06:46
help help help !!!
CamperBot
@camperbot
May 01 2016 06:46
no wiki entry for: help help
Ankur sharma
@ankur1163
May 01 2016 06:47
camperbot you can do this. I know you have been feeded with latest AI algorithm. Help me , I am stuck in json to html exercise. Ahhhhh
Mike Haslam
@Ongomobile
May 01 2016 06:47
@Martialis39 it did not work for me what i want to check is if i is not equal to var isSame
@Martialis39 here is what I have now```
var same = ["b", "b","b"];
 var different = ["b","c","e"];


function isUniform(arr) {
    var isSame = arr[0];
    for(var i = 0; i < arr.length ; i++) {
        if(arr[i] !== isSame) {
            return false;
        }
    }
    return true;

}
isUniform(same);
Martialis39
@Martialis39
May 01 2016 06:52
@Ongomobile That also totally works on my end
At least in pythontutor.com, whats the actual challenge criterion?
Mike Haslam
@Ongomobile
May 01 2016 06:54
Not sure whats going on also tried with forEach loop check to see if elements in array are the same i am using sublime text & crome console
My other function works in crome
Mike Haslam
@Ongomobile
May 01 2016 07:03
@Martialis39 thanks again for your help, also thanks for making me think instead of just giving answer, I will figure out
CamperBot
@camperbot
May 01 2016 07:03
ongomobile sends brownie points to @martialis39 :sparkles: :thumbsup: :sparkles:
:warning: ongomobile already gave martialis39 points
Ibukun
@ioluwayo
May 01 2016 07:03
Hi guys, i need help with some javascript function. i am trying to return 2 values from my function. how do i do this.
Mateusz Szymański
@matszym
May 01 2016 07:05
@ioluwayo return array/object with properties assigned to value. Other way about is to use generator
Neel Shah
@neelshah22
May 01 2016 07:12
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
  var lookup = {
    "alpha":"Adams",

    "bravo":"Boston",

    "charlie":"Chicago",

    "delta":"Denver", 

    "echo":"Easy",

   "foxtrot":"Frank"
  };



  // Only change code above this line
  result=lookup[val];
}

// Change this value to test
phoneticLookup("delta");
@rphares now what should i do?
rphares
@rphares
May 01 2016 07:13
move that line, result=lookup[val]; above the 'do not change' line, @neelshah22
UtkarshShukla7
@UtkarshShukla7
May 01 2016 07:13
@ankur1163 this line had the error
json.map(function(val) should be json.forEach(function(val)
rphares
@rphares
May 01 2016 07:13
and put back return result @neelshah22 :blush:
Neel Shah
@neelshah22
May 01 2016 07:14
thank you so much @rphares
CamperBot
@camperbot
May 01 2016 07:14
neelshah22 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 4288 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
May 01 2016 07:14
Anytime!
ALMY91
@ALMY91
May 01 2016 07:41
<html>
<head></head>
<body>

<script type="text/javascript">

alert(greeting);



</script>
</body>
</html>
hi guys why isn anything working in my console?
Mateusz Szymański
@matszym
May 01 2016 07:42
@ALMY91 you didnt define greeting variable
Robert Uivarosi
@URobert
May 01 2016 07:42
@ALMY91 hi
@ALMY91 you probably wanted 'greeting' in there
Dheeraj Kumar Dhall
@dheerajdhall27
May 01 2016 07:43
How would you go about removing duplicates from an array?
Robert Uivarosi
@URobert
May 01 2016 07:43
@ALMY91 if your not using ' or "... js is looking for a variable
ALMY91
@ALMY91
May 01 2016 07:44
@matszym @URobert thanks..
CamperBot
@camperbot
May 01 2016 07:44
almy91 sends brownie points to @matszym and @urobert :sparkles: :thumbsup: :sparkles:
:star: 26 | @matszym | http://www.freecodecamp.com/matszym
:star: 833 | @urobert | http://www.freecodecamp.com/urobert
ALMY91
@ALMY91
May 01 2016 07:45
<html>
<head></head>
<body>

<script type="text/javascript">


window.close();



</script>
</body>
</html>
how about this? what does it do
Robert Uivarosi
@URobert
May 01 2016 07:45
@ALMY91 yw
Mateusz Szymański
@matszym
May 01 2016 07:46
@dheerajdhall27 I would create hash object, literate thru array, and update hash object with current array variable if its not found on hash object
Jerkoco
@Jerkoco
May 01 2016 07:46
Hello ! Is anyone know how physics works in a multiplayer game ? the collisions must be tested on the server ? Thanks.
ALMY91
@ALMY91
May 01 2016 07:48
@URobert may i know what is a client side function?
ALMY91
@ALMY91
May 01 2016 07:49
@URobert is it a function that has an side effect with regards to the way the client interacts with the browser?
cb
@winkelman
May 01 2016 07:49
Hello! I'm wondering if anybody else is having a problem with the grader for the "Where do I belong" challenge in the Basic Algorithm Scripting. My code works for all of the test cases but the grader isn't accepting it.
Robert Uivarosi
@URobert
May 01 2016 07:49
@ALMY91 read what i've sent you
@winkelman link the code
cb
@winkelman
May 01 2016 07:51
Also, here's my code:
function getIndexToIns(arr, num) {
  // Find my place in this sorted array.
  arr.sort(function(a, b) {return a - b;});
  var tooBig = true;

  for(var index in arr) {
    if(num <= arr[index]) {
      tooBig = false;
      break;
    }
  }

  if(tooBig) {
    index++;
  }

  //arr.splice(index, 0, num);
  return index;
}
ALMY91
@ALMY91
May 01 2016 07:51
@URobert am i right with my assumption? thats what it seems to be stated on the forum
Amande
@wormwoods
May 01 2016 07:51
@camperbot Please explanation about Early pattern for Functions
rphares
@rphares
May 01 2016 07:52
you mean the challenge return early?
to get him to do it, start with wiki or help or explain and then keywords... not @camperbot . I'll do the example, @waasiwaasi
wiki return early
CamperBot
@camperbot
May 01 2016 07:52

:point_right: challenge return early pattern for functions [wiki]

Challenge: Return Early Pattern for Functions

When a return statement is reached, the execution of the current function stops and control returns to the calling location.

Example

function myFun() {
  console.log("Hello");
  return "World";
  console.log("byebye")
}
myFun();

The above outputs "Hello" to the console, returns "World", but "byebye" is never output, because the function exits at the return statement.
:pencil: read more about challenge return early pattern for functions on the FCC Wiki

ALMY91
@ALMY91
May 01 2016 07:53
@URobert client side functions causes side effects on the browser.. in reaction to the way that the user interacts with it . And the user is able to view these side effects
Dheeraj Kumar Dhall
@dheerajdhall27
May 01 2016 07:53
@matszym ok i will read about it
ALMY91
@ALMY91
May 01 2016 07:53
@URobert with regards to server side, the client is not able to view whats going on
Jerkoco
@Jerkoco
May 01 2016 07:54
Hello ! Is anyone know how physics works in a multiplayer game ? the collisions must be tested on the server ? Thanks.
24manish
@24manish
May 01 2016 07:54
someone please send me the solution of "Join Strings with join".
Robert Uivarosi
@URobert
May 01 2016 08:00
@ALMY91 i`m not sure that is accurate. I'm not familiar with the definitions, that is why I handed you the link. However that explains the difference between server-side scripting and client-side scripting.
@ALMY91 with regards to server side, the client is not able to view whats going on this can't be right, because based on how your backend script is written you can display everything in the browser if you want
Boyce
@Yijianc
May 01 2016 08:01
help Validate US Telephone Numbers
CamperBot
@camperbot
May 01 2016 08:01

:point_right: algorithm validate us telephone numbers [wiki]

Problem Explanation:

  • The task is not that hard to understand, implementing it is the hardest part. You have a to validate an US phone number. This means there is a certain amount of numbers required, while you don't need to put the country code, you will still need the area code and use one of the few formats allowed.
:pencil: read more about algorithm validate us telephone numbers on the FCC Wiki
EricOber
@EricOber
May 01 2016 08:05
hi
ALMY91
@ALMY91
May 01 2016 08:10
@URobert okay thanks anyways
CamperBot
@camperbot
May 01 2016 08:10
almy91 sends brownie points to @urobert :sparkles: :thumbsup: :sparkles:
:warning: almy91 already gave urobert points
Robert Uivarosi
@URobert
May 01 2016 08:10
@ALMY91 yw, np. Sorry I can't give you a better answer
ALMY91
@ALMY91
May 01 2016 08:11
<html>
<head></head>
<body>

<script type="text/javascript">

var a=[1,2,3,4,5,6]
for (i=0; i<a.length;a[i++]=0);

</script>
</body>
</html>
i don really understood what the last statement meant in the forloop..
and also nth is happening in my console
i don really understand what a[i++]=0 does?
usually the ones i come across is i++
Robert Uivarosi
@URobert
May 01 2016 08:14
@ALMY91 where di you get that from?
ALMY91
@ALMY91
May 01 2016 08:14
i got it from the definitive javascript guide
its a book
Robert Uivarosi
@URobert
May 01 2016 08:14
@ALMY91 I never saw that syntax lol
Zito Relova
@zitorelova
May 01 2016 08:14
can anyone help me with the card counting challenge?
how do I get the var count to go up and down?
Mateusz Szymański
@matszym
May 01 2016 08:15
++ or --, or variable +=1 or variable -=1 or variable = variable + 1 or variable = variable - 1
Jevaughn Vance
@jvans7
May 01 2016 08:30
would like some help for Lesson number 77 and 85 please. Hope someone has completed it
rphares
@rphares
May 01 2016 08:31
hey, @jvans7 -- the lessons dont have numbers, actually. those are your points...
could you tell people the challenge names and paste the formatted code, please? :blush:
Jevaughn Vance
@jvans7
May 01 2016 08:34

var count = 0;

function cc(card) {
// Only change code below this line

return "Change Me";
// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

its the card counting challenge @rphares
rphares
@rphares
May 01 2016 08:36
okay,
you can do counting cards with an if/else or a switch
This message was deleted
Jevaughn Vance
@jvans7
May 01 2016 08:37

switch (card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count+= 1;
break;
case 7:
case 8:
case 9:
count+= 0;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count-= 1;
break;

}

return count + (count > 0 ? "Bet" : "Hold");
thats my code @rphares

rphares
@rphares
May 01 2016 08:37
(i made that up)
huh
did you remove the var from the top? one sec, lemme pull mine up, but i dont see count declared anywhere? @jvans7
Jevaughn Vance
@jvans7
May 01 2016 08:39
var count = 0;
function cc(card) {
is at the top
Boyce
@Yijianc
May 01 2016 08:44
help Symmetric Difference
CamperBot
@camperbot
May 01 2016 08:44

:point_right: algorithm symmetric difference [wiki]

Problem Explanation:

Symmetric Difference is the difference between two sets.

So in the Symmetric Difference Algorithm you would work through the arrays of numbers something like this -

sym(A, B, C) Translates to sym(sym(A,B),C)

Or in plain English - First find the Symmetric Difference of Set A and Set B. Then find the Symmetric Difference of this new set and Set C.

So -

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

would equal

[1,4,5]

Here's a nice video tutorial (with an awful fake British accent!) -

YouTube - Symmetric Difference
:pencil: read more about algorithm symmetric difference on the FCC Wiki

rphares
@rphares
May 01 2016 08:44
OH
one thing, @jvans7 -- do you have a space in the beginning of those strings?
if you return 5Bet, it will fail...
Jevaughn Vance
@jvans7
May 01 2016 08:48
I got it @rphares I didn't do anything different i tired again and it took the code
rphares
@rphares
May 01 2016 08:49
lol, cool cool, congrats!
(though it should have if you are missing a space, thats weird...)
the-tafadzwa
@the-tafadzwa
May 01 2016 08:49

hi guys. I am having problems with Using Objects for Lookups.
Here is my code:
```// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
result = {
"alpha": "Adams",
"bravo":"Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank",
};

// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("alpha");
```

rphares
@rphares
May 01 2016 08:50
good start, @the-tafadzwa ~
so, we have a few things to do still
Jevaughn Vance
@jvans7
May 01 2016 08:50
I just reset it and paste it over and it took it. its either JavaScript weird or the tester lol
rphares
@rphares
May 01 2016 08:50
first, the directions say something like 'make a table called lookup @the-tafadzwa
their example table was called var alpha .... but yours is currently just result...
what should you change that to?
the-tafadzwa
@the-tafadzwa
May 01 2016 08:52
@rphares I'm guessing I should change 'result' to 'var lookup'?
rphares
@rphares
May 01 2016 08:53
yep!
thats the first thing
then, you would have completed that first direction (make a table called lookup)
next, we still need to do the next instruction, which was something like 'Use it to lookup val and return the associated string'...
this part will take a few steps :blush:
let's look at their example of how to use objects :blush:
their table is called var alpha and they want to get the string associated with 2, so they write alpha[2], right?
the-tafadzwa
@the-tafadzwa
May 01 2016 08:54
yep
rphares
@rphares
May 01 2016 08:55
so, your table is now called var lookup and you want to get the string associated with val, so you can write...?
rphares
@rphares
May 01 2016 09:01
@the-tafadzwa ...?
Jevaughn Vance
@jvans7
May 01 2016 09:02
i'm on the same lesson @rphares

function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {
"alpha":"Adams",
"bravo":"Boston",
"charlie":"Chicago",
"delta":"Denver",
"echo":"Easy",
"foxtrot":"Frank"
};

result =
// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("charlie");

rphares
@rphares
May 01 2016 09:02
oooh, good-
you new to reset result, well done!
and, you are at the exact same spot--
you need to use obj[key] to complete this instruction:
'Use it to lookup val and return the associated string'...
so, in result, what you will store is the objectName[key]
what is your object called, @jvans7 ?
the-tafadzwa
@the-tafadzwa
May 01 2016 09:04
@rphares , my connection is acting up a bit
rphares
@rphares
May 01 2016 09:04
ahh, gotcha-- no worries, just thought you gave up on me :blush: @the-tafadzwa
you are both at the same spot~
let's look at their example of how to use objects :blush:
their table is called var alpha and they want to get the string associated with 2, so they write alpha[2], right?
so, your table is now called var lookup and you want to get the string associated with val, so you can write...?
Jevaughn Vance
@jvans7
May 01 2016 09:06
lookup[val]
rphares
@rphares
May 01 2016 09:06
yep, @jvans7 ~ Just store that in your result = and you should be good to go! :)
the-tafadzwa
@the-tafadzwa
May 01 2016 09:07
Got it! Thanks @rphares
CamperBot
@camperbot
May 01 2016 09:07
the-tafadzwa sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 4291 | @rphares | http://www.freecodecamp.com/rphares
Jevaughn Vance
@jvans7
May 01 2016 09:07
@rphares i was trying that about 15mins ago and all i was missing was ;
rphares
@rphares
May 01 2016 09:07
(you may also want to google a bit about 'objects' and 'keys' or 'key value pairs'.... I'm not the best at explaining that and dont have a great resource, but its a bit useful and worth reading up on :blush: @the-tafadzwa @jvans7 )
Ahh, gotcha, it happens to the best of us, heh @jvans7 :blush:
Jevaughn Vance
@jvans7
May 01 2016 09:08
@rphares thanks
CamperBot
@camperbot
May 01 2016 09:08
jvans7 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 4292 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
May 01 2016 09:08
(and I'm by no means the best, a newbie here so soon you'll be passed what i can help with~)
Anytime, both of you @the-tafadzwa and @jvans7 ! Happy coding :)
Jevaughn Vance
@jvans7
May 01 2016 09:08
@rphares you the man
you're
rphares
@rphares
May 01 2016 09:08
:blush:
the-tafadzwa
@the-tafadzwa
May 01 2016 09:09
will definitely spend some time reading on it
Chris Cullen
@123xylem
May 01 2016 09:13
help Mutations
CamperBot
@camperbot
May 01 2016 09:13

:point_right: algorithm mutations [wiki]

Problem Explanation:

  • Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array..
:pencil: read more about algorithm mutations on the FCC Wiki
Boyce
@Yijianc
May 01 2016 09:15
help Exact Change
CamperBot
@camperbot
May 01 2016 09:15

:point_right: algorithm exact change [wiki]

Problem Explanation:

  • You have to create a program that will handle when the register does not have
    enough cash or will have no cash after the transaction. Other than that it
    needs to return an array of the change in the form of an array, so that will
    be a 2D array.
:pencil: read more about algorithm exact change on the FCC Wiki
Chris Cullen
@123xylem
May 01 2016 09:19
Am I anywhere near getting this right? I am trying to see if the first array of mutation has all the letters of the second element ignoring case.
function mutation(arr) {

 var word= arr.pop();

  var rule= arr.pop();
  if (rule.indexOf(word(/i/)));
  {return true;}
   return false;
}

mutation(["hello", "hey"]);
Its saying word is not a function though
When I take out the /i/ it works but for some reason includes true even if not all the letters are in "rule"
Robert Uivarosi
@URobert
May 01 2016 09:25
@123xylem first off, you should convert the letters of both arr[0] and arr[1] to either lower or upper case
Rada
@Radascript
May 01 2016 09:27
@123xylem I'm not totally sure, but I think when indexOf can't find a string, it returns -1, not "false"
Robert Uivarosi
@URobert
May 01 2016 09:27
@Radascript you are right
Chris Cullen
@123xylem
May 01 2016 09:31
yea
function mutation(arr) {

 var word= arr.pop().toLowerCase;

  var rule= arr.pop().toLowerCase;
  if (rule.indexOf(word));
  {return true;}
   return false;
}

mutation(["hello", "neo"]);
Now its saying rule.indexOf isnt a function again...
James Becker
@james-becker
May 01 2016 09:32
Anyone can help this guy with Sum All Primes?
I'm almost there... something is off though
var sumPrimes = function(num) {
  var arr = [];
  var max = Math.sqrt(num);
  var sum = 0;

  for (var i = 0; i < num; i++) {
    arr.push(true);
  }

  for (var i = 2; i <= max; i++) {
    if (arr[i]) {
      for (var j = Math.pow(i, 2); j < num; j = j + i) {
        arr[j] = false;
      }
    }
  }

  for (i = 2; i < num ; i++) {
    if (arr[i] === true) {
      sum += i;
    }
  }

  return sum;
};

console.log(sumPrimes(977));
I'm getting a number very close to the answer
But it's slightly off
Travis
@dukenukethem
May 01 2016 09:34
Hello everyone, I was wondering if I could get some basic help because I know this is abasic problem that I am just not understanding.
Aleksander Gębicki
@Takumar
May 01 2016 09:35

@123xylem you have to add parentheses in two places:

 toLowerCase();

because without that you don't run that function.

Travis
@dukenukethem
May 01 2016 09:35
Currently stuck on the "Stand in line" challenge as I am not understanding the instructions
Chris Cullen
@123xylem
May 01 2016 09:36
@Takumar thanks
CamperBot
@camperbot
May 01 2016 09:36
123xylem sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:star: 3158 | @takumar | http://www.freecodecamp.com/takumar
Martialis39
@Martialis39
May 01 2016 09:36
help roman numeral converter
CamperBot
@camperbot
May 01 2016 09:36

:point_right: algorithm roman numeral converter [wiki]

Problem Explanation:

  • You will create a program that converts an integer to a Roman Numeral.
:pencil: read more about algorithm roman numeral converter on the FCC Wiki
Aleksander Gębicki
@Takumar
May 01 2016 09:36
@123xylem you are welcome.
Robert Uivarosi
@URobert
May 01 2016 09:36
@123xylem I'm sure there is a better approach. I just wrote this:
function mutation(arr) {

 var i = 0, confirm = 1;

 var testedString = arr[0].toUpperCase().split("");
 console.log(testedString);
 var lettersToCheckFor = arr[1].toUpperCase().split("");
 console.log(lettersToCheckFor);

 for (i = 0; i < lettersToCheckFor.length; i++){
         if (testedString.indexOf(lettersToCheckFor[i]) !== -1){
    confirm *= 1;
    }else{
    confirm *= 0;
    }
 }

 if (confirm){
 return true;
 }else{
 return false;
 }

}

mutation(["hello", "hey"]);
James Becker
@james-becker
May 01 2016 09:38
help stand in line
CamperBot
@camperbot
May 01 2016 09:38

:point_right: challenge stand in line [wiki]

Checkpoint: Stand In Line

About queues

In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.

Instructions

Write a function nextInLine which takes an "array" and an "item" as arguments.

Add the item onto the end of the array, then remove the first element of the array.

The nextInLine function should return the element that was removed.

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

:pencil: read more about challenge stand in line on the FCC Wiki

Travis
@dukenukethem
May 01 2016 09:38
I get confused when its telling me to create a function; when that function is already there.
Aleksander Gębicki
@Takumar
May 01 2016 09:39
@dukenukethem so modify existing function to make the things you are asked to.
  • You have to add item element to the arr array
  • remove first element from arr array
  • return removed element with return statement
Chris Cullen
@123xylem
May 01 2016 09:39
@URobert nice,,, i still havent solved it anyway
James Becker
@james-becker
May 01 2016 09:41
@dukenukethem You need to do two things. First, push the second argument ("item") onto the end of the queue (in this case, the end of the array)
Aleksander Gębicki
@Takumar
May 01 2016 09:41
@dukenukethem for sure you know methods push() and shift() for working on arrays.
James Becker
@james-becker
May 01 2016 09:42
@dukenukethem Then just unshift the first item from the "arr" array and set it as the "item" var
Mike Haslam
@Ongomobile
May 01 2016 09:42
@Martialis39 I found my problem just need to call function in chrome thanks for your help
CamperBot
@camperbot
May 01 2016 09:42
ongomobile sends brownie points to @martialis39 :sparkles: :thumbsup: :sparkles:
:star: 288 | @martialis39 | http://www.freecodecamp.com/martialis39
Travis
@dukenukethem
May 01 2016 09:42
I must be tired, I'm not understanding haha
James Becker
@james-becker
May 01 2016 09:42
@dukenukethem
Step 1: arr.push(item)...
with that you just pushed the second argument (the item var) onto the end of the array
Chris Cullen
@123xylem
May 01 2016 09:43
What am i Missing here? This code lets neo be true even though NEO letters arent all in hello! Is my use of .indexOf wrong here?
function mutation(arr) {

 var word= arr[1].toLowerCase();

  var rule= arr[0].toLowerCase();
  if (rule.indexOf(word) !== -1);
  {return true;}
   return false;
}

mutation(["hello", "neo"]);
James Becker
@james-becker
May 01 2016 09:43
so the first line of code in your function should be
arr.push(item);
Amande
@wormwoods
May 01 2016 09:44
Hi, @rphares Can you help me with the challenge Return Early Pattern for Functions Please :blush:
James Becker
@james-becker
May 01 2016 09:44
@dukenukethem
and the rest should look something like:
  item = <use an array method here>;
  return item;
}
rphares
@rphares
May 01 2016 09:45
@waasiwaasi , sure!
can you paste the code you have tried?
Travis
@dukenukethem
May 01 2016 09:47
yeah, I must be tired...I'm totally mind blocked on this challenge haha
James Becker
@james-becker
May 01 2016 09:47
There are only two solutions for tired: coffee and sleep! Choose one ;)
Travis
@dukenukethem
May 01 2016 09:48
I get the arr.push(item) adds the number to the end of the array...I'm not getting how to remove the first element of the array afterwards
Aleksander Gębicki
@Takumar
May 01 2016 09:48
@dukenukethem just call shift() method on the array - it removes that first element and returns to you removed element.
rphares
@rphares
May 01 2016 09:48
You live where i want to... crazy jealous, @james-becker ! (sorry, not the social room, just... jealous! :blush: )
Travis
@dukenukethem
May 01 2016 09:49
so; return item.shift();?
Aleksander Gębicki
@Takumar
May 01 2016 09:49
@dukenukethem great job!
No wait, item is not array :-)
Travis
@dukenukethem
May 01 2016 09:49
it says TypeError lol
so it'd be return arr.shift();
HOLY THANK YOU EVERYONE
Aleksander Gębicki
@Takumar
May 01 2016 09:50
@dukenukethem yes, item is the element to add to array arr
James Becker
@james-becker
May 01 2016 09:50
arr.shift() = item
Travis
@dukenukethem
May 01 2016 09:50
I literally want to throw my computer
James Becker
@james-becker
May 01 2016 09:50
@dukenukethem now reverse that
Aleksander Gębicki
@Takumar
May 01 2016 09:50
@dukenukethem everyone is the same as no one!
Travis
@dukenukethem
May 01 2016 09:50
how do I paste my code?
because I dont have what @james-becker said lol
rphares
@rphares
May 01 2016 09:51
explain format
CamperBot
@camperbot
May 01 2016 09:51

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

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

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

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

rphares
@rphares
May 01 2016 09:51
@dukenukethem :point_up:
James Becker
@james-becker
May 01 2016 09:51
Screen Shot 2016-05-01 at 4.51.05 PM.png
@dukenukethem
@rphares It's quite the place to be ;)
Travis
@dukenukethem
May 01 2016 09:53
function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  return arr.shift();  // Change this line
}
thats what I have
Aleksander Gębicki
@Takumar
May 01 2016 09:53
@dukenukethem and that's okay
Travis
@dukenukethem
May 01 2016 09:53
what was james talking about with arr.shift() = item ?
```js
woops lol
James Becker
@james-becker
May 01 2016 09:54
@dukenukethem You need to set "item =" as arr.shift()
so that "item" now points to "arr.shift()"
Felix
@Felix020
May 01 2016 09:55
So I'm trying to access my JSON object in a function using variables, for example
James Becker
@james-becker
May 01 2016 09:55
arr.shift() is merely a sort of function that "breaks off" and returns the first entry in the array
technically shift() is a method that can be used on any variable that is of type array
usually it's used like this:
shiftedElement = array.shift()
@dukenukethem
Travis
@dukenukethem
May 01 2016 09:57
so it would be like arr = arr.shift(); ??
or am I totally out of the ballpark haha
James Becker
@james-becker
May 01 2016 09:57
no... because then you would be pointing the "arr" variable to arr.shift()
you want to point "item" to arr.shift()
Aleksander Gębicki
@Takumar
May 01 2016 09:57
@dukenukethem arr = arr.shift() is destroying your array by overwriting it, you cannot use that array anymore :-( you are loosing all values inside it.
You array changes to variable with single value.
James Becker
@james-becker
May 01 2016 09:57
you point to something with the "=" sign ;)
Travis
@dukenukethem
May 01 2016 09:59
function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  item = arr.shift();
  return arr.shift();  // Change this line
}
so something like this?
James Becker
@james-becker
May 01 2016 09:59
Very close!
Paresh Shrivastava
@Paresh18
May 01 2016 09:59
backslash tab tab carriage-return new-line assign to mystr I am not able to get the correct answer of this,does anyone know this?
rphares
@rphares
May 01 2016 09:59
yep--
James Becker
@james-becker
May 01 2016 09:59
but since "item" now equals "arr.shift()", you might want to just return the "item" itself
rphares
@rphares
May 01 2016 09:59
so, you want to use the chart to turn that into code, @Paresh18
for example, backslash would be \\ @Paresh18
Travis
@dukenukethem
May 01 2016 10:00
OH so now I just have to do ```js
rphares
@rphares
May 01 2016 10:00
and you want to store it all in a string in the var provided, @Paresh18
Paresh Shrivastava
@Paresh18
May 01 2016 10:00
yes I had tried this
rphares
@rphares
May 01 2016 10:00
(i think it was var myStr or something like that)
Amande
@wormwoods
May 01 2016 10:00
@rphares thanks for your kind, just got it (forgot the curly brace HAHA) :blush:
CamperBot
@camperbot
May 01 2016 10:00
waasiwaasi sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 4295 | @rphares | http://www.freecodecamp.com/rphares
Travis
@dukenukethem
May 01 2016 10:00
arr.push(item);
item = arr.shift();
return item;
rphares
@rphares
May 01 2016 10:00
can you paste what you tried, @Paresh18 ?
Travis
@dukenukethem
May 01 2016 10:00
yes?
rphares
@rphares
May 01 2016 10:00
Oh, Awesome, congrats, @waasiwaasi !! Happy coding~
James Becker
@james-becker
May 01 2016 10:00
@dukenukethem Bravo
Paresh Shrivastava
@Paresh18
May 01 2016 10:00
var myStr="\ \t \t carriage-return\n"
Travis
@dukenukethem
May 01 2016 10:00
@james-becker Thank you!
CamperBot
@camperbot
May 01 2016 10:00
dukenukethem sends brownie points to @james-becker :sparkles: :thumbsup: :sparkles:
:star: 291 | @james-becker | http://www.freecodecamp.com/james-becker
Travis
@dukenukethem
May 01 2016 10:01
why does it say to change the line if the line doesn't need to be changed.
rphares
@rphares
May 01 2016 10:01
Ah-- you need to turn carriage-return into code as well, @Paresh18
what is return on that chart?
Paresh Shrivastava
@Paresh18
May 01 2016 10:01
its \r
done that
rphares
@rphares
May 01 2016 10:02
so put that where you have carriage-return :blush:
also, probs want a ;
Paresh Shrivastava
@Paresh18
May 01 2016 10:02
it works
thanks @rphares
CamperBot
@camperbot
May 01 2016 10:02
paresh18 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 4296 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
May 01 2016 10:02
awesome--congrats and happy coding, @Paresh18 ! :blush:
James Becker
@james-becker
May 01 2016 10:02
@dukenukethem I don't usually pay too much attention to FCC's commenting. Maybe I should.
Travis
@dukenukethem
May 01 2016 10:03
```js
fudge
rphares
@rphares
May 01 2016 10:03
@dukenukethem @james-becker in that particuarl instance, there is more than one way to solve it,
if you change that line, you can do it in two,
if you incorporate it, its three
Travis
@dukenukethem
May 01 2016 10:03
function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  item = arr.shift();
  return arr.shift();  // Change this line <---Right here
}
rphares
@rphares
May 01 2016 10:03
thats all shrug
Travis
@dukenukethem
May 01 2016 10:03
Gotcha, Thanks @rphares
CamperBot
@camperbot
May 01 2016 10:03
dukenukethem sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 4297 | @rphares | http://www.freecodecamp.com/rphares
James Becker
@james-becker
May 01 2016 10:03
@rphares Right.
@dukenukethem In that case, you can just delete the second line of the function
function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  return arr.shift();  // Change this line <---Right here
}
Travis
@dukenukethem
May 01 2016 10:04
that second line was a mistake that i didnt delete before posting haha.
rphares
@rphares
May 01 2016 10:05
(that said, some of the comments are part of the point-- the do not change below this line ones, for example... part of the lesson may be connecting the code to a return, reminding people about resetting a var, etc. In this instance, its fairly unimportant, but in other challenges, for beginners, its far more so :blush: )
Travis
@dukenukethem
May 01 2016 10:05
i was trying to figure out how to make item = arr wit hthat line
James Becker
@james-becker
May 01 2016 10:05
@rphares Absolutely. The comments are generally very helpful.
Travis
@dukenukethem
May 01 2016 10:07
For the longest time I was under the impression that I had to complete everything in order...when it came to doing the HTML projects I'm stuck on the last one where you make your own portfolio page. I stopped coding for like two weeks because ive been stuck on that and didnt think i could move forward
James Becker
@james-becker
May 01 2016 10:09
@dukenukethem
Yeah, I thought that too for a while. It's a good thing you're allowed to do them out of order or I have a feeling a lot more people would get stuck and never move forward. I'm actually doing all of the bonfires first, all the way through advanced, before I move onto the projects. Doesn't hurt to have the nuts and bolts in place...
Travis
@dukenukethem
May 01 2016 10:09
bonfires are what im doing now right?
James Becker
@james-becker
May 01 2016 10:10
Actually what you're doing right now are "Waypoints", small lessons designed to teach you how to utilize specific methods and implement basic algorithms
Bonfires are more like "tests" that see how well you can put everything you learned together to solve more complex problems
Waypoints aren't required for any FCC certifications, but all of the bonfiress are
Travis
@dukenukethem
May 01 2016 10:11
Oh okay; thanks for the info :)
James Becker
@james-becker
May 01 2016 10:12
Sure :)
Robert Uivarosi
@URobert
May 01 2016 10:12
@james-becker those are the old names used to structure the curriculum
James Becker
@james-becker
May 01 2016 10:13
@URobert Oh, ok. Wasn't aware they'd been changed. What are they using instead?
Robert Uivarosi
@URobert
May 01 2016 10:13
from what I saw, now you have the basic, intermediate and advanced algorithms scripting.
those would be old bonefires ( I guess)
there are all algorithms
the rest seem like waypoints
I finished them a long time ago so I can't say for sure
James Becker
@james-becker
May 01 2016 10:14
yeah
Travis
@dukenukethem
May 01 2016 10:14
how many months have you guys been coding?
Robert Uivarosi
@URobert
May 01 2016 10:14
@james-becker take a look at the map for the new structure
James Becker
@james-becker
May 01 2016 10:14
Looks like the advanced algorithms aren't actually required like I thought they were... just the intermediate ones
Robert Uivarosi
@URobert
May 01 2016 10:15
@dukenukethem I started (seriously) on Nov 1st. Got a job at the beginning of April ;)
James Becker
@james-becker
May 01 2016 10:15
@URobert Whoa, congrats
Robert Uivarosi
@URobert
May 01 2016 10:15
@dukenukethem have been coding 40h+/week (with no days off) since Nov 1st
Travis
@dukenukethem
May 01 2016 10:15
@URobert congrats :D was it through FCC? Or did you earn your certs
Robert Uivarosi
@URobert
May 01 2016 10:15
@james-becker thanks ;) :+1:
CamperBot
@camperbot
May 01 2016 10:15
urobert sends brownie points to @james-becker :sparkles: :thumbsup: :sparkles:
:star: 292 | @james-becker | http://www.freecodecamp.com/james-becker
James Becker
@james-becker
May 01 2016 10:16
@dukenukethem I've been bouncing around between Ruby, Python and JS for a sum total of a couple months
Robert Uivarosi
@URobert
May 01 2016 10:16
@dukenukethem thx. I got the job because of the knowledge acquired by building the projects and working on the curriculum
CamperBot
@camperbot
May 01 2016 10:16
urobert sends brownie points to @dukenukethem :sparkles: :thumbsup: :sparkles:
:star: 194 | @dukenukethem | http://www.freecodecamp.com/dukenukethem
rphares
@rphares
May 01 2016 10:16
yes, they have become optional... core team said (really rough paraphrase) that being able to make working code was more valuable for employment than focusing on drilling algos. @james-becker
Robert Uivarosi
@URobert
May 01 2016 10:16
They didn't know about FCC ofc, but I was able to answer most of the questions in the technical interview
Travis
@dukenukethem
May 01 2016 10:17
That's amazing; so you just took what you learned from here and applied it into your interview/job
James Becker
@james-becker
May 01 2016 10:17
thanks @rphares
CamperBot
@camperbot
May 01 2016 10:17
james-becker sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 4298 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
May 01 2016 10:17
Sure thing~
James Becker
@james-becker
May 01 2016 10:17
@URobert I wonder if you've set some sort of record, that being only 5 months of learning
Travis
@dukenukethem
May 01 2016 10:17
What kind of job is it? Front end or backend?
Robert Uivarosi
@URobert
May 01 2016 10:17
@dukenukethem Mostly yes. Additionally before the technical interview, I prepared by studying textbook interview questions etc
James Becker
@james-becker
May 01 2016 10:18
@URobert Was not telling them about FCC a strategic move?
Robert Uivarosi
@URobert
May 01 2016 10:18
@dukenukethem I went in with only front end knowledge (I barely started backend at that point)... I told them I wanted to become full stack eventually. So they got me learning a backend know
Travis
@dukenukethem
May 01 2016 10:19
So your job gives you learning materials as well as using FCC?
Robert Uivarosi
@URobert
May 01 2016 10:19
@james-becker I told them about FCC, how it works, what I have learned here. I meant that they didn't know/hear about FCC before, and the actual certificate don't think had much of an influence
James Becker
@james-becker
May 01 2016 10:20
ok
Robert Uivarosi
@URobert
May 01 2016 10:20
@dukenukethem I'm working on getting good with php and mysql atm. So I use FCC only in my spare time to help people out in the chat... and work on some front end on the side
James Becker
@james-becker
May 01 2016 10:21
@URobert Do you enjoy PHP? I've heard mixed things about it
Robert Uivarosi
@URobert
May 01 2016 10:22
@james-becker I gtg. I do :) I first though I won't, but I actually do. The more I know the better. Full stack is end goal D:
the*
@james-becker @dukenukethem gl and happy coding at FCC! ;)
Travis
@dukenukethem
May 01 2016 10:23
thanks @URobert
CamperBot
@camperbot
May 01 2016 10:23
dukenukethem sends brownie points to @urobert :sparkles: :thumbsup: :sparkles:
:star: 834 | @urobert | http://www.freecodecamp.com/urobert
James Becker
@james-becker
May 01 2016 10:24
@URobert Peace.
Vivek
@vivek28111992
May 01 2016 10:34
can anybody explain me why this is passing only even no. of index letter
function processData(input) {
    //Enter your code here
    var regex= /[a-zA-Z]/g;
    for(var i = 0;i < input.length;i++){
        if(regex.test(input[i])){
            var split = input[i].split();
            console.log(split);
        }
        else{

        }
    }
}
Amande
@wormwoods
May 01 2016 10:35
This message was deleted
Sergej Vasiljev
@vasilijus
May 01 2016 10:35
hi, how do i get rid of the second array inside
var myArray = [["John", 23], ["cat", 2]];
both of the values
Amande
@wormwoods
May 01 2016 10:35
This message was deleted
Travis
@dukenukethem
May 01 2016 10:37
@vasilijus you want to "pop" the variable.
Aleksander Gębicki
@Takumar
May 01 2016 10:37
@vasilijus you array myArray has two elements so just remove it using myArray.pop()
Travis
@dukenukethem
May 01 2016 10:38
@Takumar I thought giving straight up answers was against the rules?
Aleksander Gębicki
@Takumar
May 01 2016 10:38
@vasilijus elements of your array are arrays, so you remove entire second array with pop() method.
naassi
@naassi
May 01 2016 10:38
Hey all this is alot of code for one challenge but does anyone know what im doing wrong, my check and range functions work fine and im trying to use them in a recursive find function which checks each num if they all pass check it returns number or if not it recalls the function num +1 ?
Aleksander Gębicki
@Takumar
May 01 2016 10:39
@dukenukethem sorry, there is a thin border between giving direct instruction and only hints. Sometimes challenge is so short that giving answer is the shortest way to explain it.
naassi
@naassi
May 01 2016 10:39
function smallestCommons(arr, count) {
  function check(arg) {
    return arg%2 === 0;
  }

  function makeRange(arr) {
    arr.sort();
    var range = [];
    for(var i = arr[0]; i <= arr[1]; i ++) {
      range.push(i);
    }
    return range;
  }

  function findMulti(num, range ,check) {
    range.forEach( function(arg) {
      if(check(num)) { return findMulti(num +1, range, check);}
      return num;
    });
  }

  return findMulti(1, makeRange(arr), check);

}


small