These are chat archives for FreeCodeCamp/HelpJavaScript

11th
Jan 2017
Jason Luboff
@JLuboff
Jan 11 2017 00:00
@timothy-kavalenka I'm not really sure how else to explain it.. @forkerino can you explain it any different?
Moisés Man
@moigithub
Jan 11 2017 00:03

@timothy-kavalenka the example code have 4 lines
a function declaration

function ourReusableFunction() {
  console.log("Heyya, World");
}

and a function calling ( a function name followed by a set of parenthesis )
ourReusableFunction();

@timothy-kavalenka soo ur code should also have 4 lines
1 function declaration
and a function calling...
the ONLY DIFFERENCE is the function NAME
wbissac723
@wbissac723
Jan 11 2017 00:05
anyone working on the Algorithms?
Almas
@AlmasJush
Jan 11 2017 00:10
anyone remember profile lookup challenge
oshane-willy99
@oshane-willy99
Jan 11 2017 00:10
@oshane-willy99 We want to use item since its our parameter. When we call the function standInLine([1,2,3,4], 4) (just an example) [1,2,3,4] is the parameter arr and 4 is our parameter item @JLuboff .........So?
mitron6
@mitron6
Jan 11 2017 00:11
@wbissac723 Lots of us.
@AlmasJush Yes.
CherryPlaysRoblox
@CherryPlaysRoblox1
Jan 11 2017 00:11
I'm stuck on Filter Arrays with.filter
can someone help me

var oldArray = [1,2,3,4,5,6,7,8,9,10];

// Only change code below this line.

var newArray = newArray.filter(function(val) {
return val !== 10;
});

Almas
@AlmasJush
Jan 11 2017 00:12
@wbissac723 could u check my code below i can't find out what is wrong
Bilaal
@thenewbieprogrammer
Jan 11 2017 00:12
can anyone help me out on this code pen? I’m trying to make a simple loading bar dissapear and display contents : http://codepen.io/thenewbieprogrammer/pen/KadxXL
mmoore5325
@mmoore5325
Jan 11 2017 00:13
Im having big trouble with my webpage. We have them login through facebook and google, and what they see depends on what they have filled out. We created a button during testing that runs this function, and the button works as intended. But when we run the function on login, it doesn't give the same results as when we manually click the button
mitron6
@mitron6
Jan 11 2017 00:13
@CherryPlaysRoblox1 You need to return a different value but basically correct.
mmoore5325
@mmoore5325
Jan 11 2017 00:13
Does anyone have a minute to check out my github? I use Ruby
mitron6
@mitron6
Jan 11 2017 00:14

@CherryPlaysRoblox1

Use filter to create a new array with all the values from oldArray which are less than 6.

Jason Luboff
@JLuboff
Jan 11 2017 00:14
@oshane-willy99 So...you have arr.push() already, what parameter should go inside of the push?
CherryPlaysRoblox
@CherryPlaysRoblox1
Jan 11 2017 00:14
@mitron6 Okay thx
CamperBot
@camperbot
Jan 11 2017 00:14
cherryplaysroblox1 sends brownie points to @mitron6 :sparkles: :thumbsup: :sparkles:
:cookie: 442 | @mitron6 |http://www.freecodecamp.com/mitron6
Almas
@AlmasJush
Jan 11 2017 00:16

function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i<contacts.lenght; i++){
for(var j=0; j<contact[i].length; j++){

if(firstName === contacts[i][j].FirstName && prop === contact[i][j].prop){
return contact[i][j].prop;
}
else if (firstName != contacts[i][j].firstName){
return "not such contact";
}
else if (prop != contacts[i][j].prop){
return "no such property";
}
}
}

mmoore5325
@mmoore5325
Jan 11 2017 00:16
<form method="post" action="/testemail">
    <input id ="hidden_email" name = "hidden_email" type = "text">
        <script>
            function hide_Email(){
                document.getElementById("hidden_email").value = document.getElementById("useremail").value;
            };
        hide_Email();
        </script>
    <input id="clickMe" type ="submit" onclick="hide_Email()" value="Already Registered">
</form>
That is my JS function that we have a manual button for. But when we run automatically on page load, it gives a different result, anyone know what possible reasons for that would be?
I don't really even know how to ask my question without showing alot of code. Its a 1 page webpage and my first big project. It all loads of an index.erb and things are connected to each other all over the place
We are running a bunch of none/block(hide/show) functions to display different parts of a webpage depending on what they have filled out so far. This functions runs an SQL statement when it posts to /testemail which checks, then returns the "state" of the webpage the user should be in
mmoore5325
@mmoore5325
Jan 11 2017 00:22
Is there a Ruby chatroom around here? Ruby not on rails
Cody Byers
@xcbyers
Jan 11 2017 00:22
Can anyone give me a hand on the Golf Code task?
function golfScore(par, strokes) {
  // Only change code below this line
    if (par, 1) {
    return "Hole-in-one!";
  } if (strokes <= par-2) {
    return "Eagle";
  }
Everything comes up Hole-in-one right now
Coy Sanders
@coymeetsworld
Jan 11 2017 00:24
@xcbyers you need to compare par to 1
Almas
@AlmasJush
Jan 11 2017 00:24
@mitron6 could u check my code below i can't find out what is wrong

for (var i=0; i<contacts.lenght; i++){
for(var j=0; j<contact[i].length; j++){

if(firstName === contacts[i][j].firstName && prop === contact[i][j].prop){

return contact[i][j].prop;

}

else if (firstName != contacts[i][j].firstName){
return "not such contact";
}

else if (prop != contacts[i][j].prop){
return "no such property";

}
}
}

Cody Byers
@xcbyers
Jan 11 2017 00:25
"compare"?
DavidMinAZ
@DavidMinAZ
Jan 11 2017 00:27
@forkerino Mixed news to report: your suggestion worked famously, and I even got the thumbnail to load using the image URLs being returned in the JSON in my project. However, now I'm only getting three total results back when I should be getting 10. Mind taking a look at it? Pen here: http://codepen.io/dmattiuz/pen/xgwoav?editors=0000
Cody Byers
@xcbyers
Jan 11 2017 00:28
@coymeetsworld Can you elaborate what you mean by compare?
DavidMinAZ
@DavidMinAZ
Jan 11 2017 00:29
@forkerino I still didn't sort the array by index, though, and a major thing to warn you is the search term is static right now so just use the button and it'll run the query
Coy Sanders
@coymeetsworld
Jan 11 2017 00:29
how do you check if a variable is equal to a specific number @xcbyers ?
Jason Luboff
@JLuboff
Jan 11 2017 00:29
@DavidMinAZ I think thats becuase all wikipedia is returning for "julia" is three results. If i change it to "california" I get 10 results
Cody Byers
@xcbyers
Jan 11 2017 00:30
@coymeetsworld =
Coy Sanders
@coymeetsworld
Jan 11 2017 00:30
check back on your previous challenges if you're not sure, they wouldve been the ones right before Golf Code
no, that's assignment, you need two equals to compare equality
Cody Byers
@xcbyers
Jan 11 2017 00:31
Ah.
DavidMinAZ
@DavidMinAZ
Jan 11 2017 00:31
@JLuboff That's bizarre... because I could swear the JSON had many more results returned and they were showing prior to my adding the code to get the thumbnail URLs from the response
Cody Byers
@xcbyers
Jan 11 2017 00:33
@coymeetsworld Thanks, the last few assignments haven't used it for a while.
CamperBot
@camperbot
Jan 11 2017 00:33
xcbyers sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1769 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Akinhwan
@akinhwan
Jan 11 2017 00:34
Im on Selecting from many options with Switch statements
im getting the error message

'''function caseInSwitch(val) {
var answer = "";
// Only change code below this line
case 1:
"alpha";
break;
case 2:
"beta";
break;
case 3:
"gamma";
break;
case 4:
"delta";
break;

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

// Change this value to test
caseInSwitch(1);'''

CamperBot
@camperbot
Jan 11 2017 00:35
:bulb: to format code use backticks! ``` more info
Akinhwan
@akinhwan
Jan 11 2017 00:35

```function caseInSwitch(val) {
var answer = "";
// Only change code below this line
case 1:
"alpha";
break;
case 2:
"beta";
break;
case 3:
"gamma";
break;
case 4:
"delta";
break;

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

// Change this value to test
caseInSwitch(1);```

Jason Luboff
@JLuboff
Jan 11 2017 00:36
@akinhwan You need to be assigning your case response to something
Akinhwan
@akinhwan
Jan 11 2017 00:36
so case === 1:
Jason Luboff
@JLuboff
Jan 11 2017 00:37
@akinhwan No, something = "alpha"
DavidMinAZ
@DavidMinAZ
Jan 11 2017 00:37
@JLuboff I sent the whole array that I made of the JSON out to console and it overflows the CodePen console but all 10 elements show in the browser console
Akinhwan
@akinhwan
Jan 11 2017 00:38
what would the statement be then?
Seth Church
@iEnder
Jan 11 2017 00:38
@akinhwan and it doesnt seem your casees are in a actual switch statement
Akinhwan
@akinhwan
Jan 11 2017 00:38
would there be switch statement for every case?
Jason Luboff
@JLuboff
Jan 11 2017 00:39
@DavidMinAZ Hmm...not too sure there.
Akinhwan
@akinhwan
Jan 11 2017 00:39
oh so switch statement within the function
Seth Church
@iEnder
Jan 11 2017 00:39
no all your cases go in a single statment
Akinhwan
@akinhwan
Jan 11 2017 00:39
switch(val){
case === "alpha":
break;
case==="beta":
break;
}
like so?
DavidMinAZ
@DavidMinAZ
Jan 11 2017 00:40
@JLuboff It's genuinely odd, and I'm sure I'm missing something where it's got to be cutting off after the third iteration of the array or something
Greg Duncan
@GregatGit
Jan 11 2017 00:40
@akinhwan
switch(expression) {
    case n:
        code block
        break;
    case n:
        code block
        break;
    default:
        default code block
}
Seth Church
@iEnder
Jan 11 2017 00:40
switch(v) { 
  case 1:
  code...
  break;
  case 2:
  ect..
}
Akinhwan
@akinhwan
Jan 11 2017 00:40
ah ok got it, one sec
Almas
@AlmasJush
Jan 11 2017 00:41
@mitron6 r u there?
Greg Duncan
@GregatGit
Jan 11 2017 00:41
@akinhwan you default block covers any that didnt come up
Akinhwan
@akinhwan
Jan 11 2017 00:42
  switch(val){
    case 1:
      answer="alpha";
      break;
    case 2:
      answer= "beta";
      break;
    case 3:
      answer= "gamma";
      break;
    case 4:
      answer= "delta";
      break;

  }
i passed it thanks everyone
Seth Church
@iEnder
Jan 11 2017 00:43
:+1:
David Kang
@d-kang
Jan 11 2017 00:45
do i need to know css to start javascript? went through about 70% of codeacademy and 50% of khan academy html and css tracks
Jason Luboff
@JLuboff
Jan 11 2017 00:46
@d-kang No but it helps to know it for the design aspect
Zaluth
@Zaluth
Jan 11 2017 00:47
i'm stuck here, seek and destroy challenge, help?
function destroyer(arr) {

  var args = Array.prototype.slice.call(arguments);
  var spliced = args.splice(-(args.length-1), args.length-1);

  var filtered = args.filter(function(){
    return args.indexOf(spliced) === -1;
  });

  return filtered;

  // args = [[1, 2, 3, 1, 2, 3]]
  // spliced = [2, 3]

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
David Kang
@d-kang
Jan 11 2017 00:47
@JLuboff yea, i just want to take a short break from it and jump a head to javascript. any recommendations on a good place to start?
FreeHandz
@FreeHandz
Jan 11 2017 00:48

hello guys, i need help with the mutation challenge.
function mutation(arr) {
for (i = 0; i > arr1.length; i++) {
if (arr[0].indexOf(arr[i]) < 0) {
return false;
}
}
}

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

"The arguments ["hello", "hey"] should return false because the string "hello" does not contain a "y".

Lastly, ["Alien", "line"], should return true because all of the letters in "line" are present in "Alien".

Am i in the right path with my code?

Jason Luboff
@JLuboff
Jan 11 2017 00:49
@d-kang Jump into FCC. They start with jQuery, but thats going to be a lot of modifying webpages so you might want to go to the section following that ( i think, I'd have to look)
liamllorin1
@liamllorin1
Jan 11 2017 00:49
how do I put my code in the black space into the chat box? like do I screenshot it or copy it or what?
how do I put my code in the black space into the chat box? like do I screenshot it or copy it or what?
_
Jason Luboff
@JLuboff
Jan 11 2017 00:52
''' see more info
CamperBot
@camperbot
Jan 11 2017 00:52
:bulb: to format code use backticks! ``` more info
liamllorin1
@liamllorin1
Jan 11 2017 00:53
yall are awesome!
Zaluth
@Zaluth
Jan 11 2017 00:53
i'm stuck here, seek and destroy challenge, help?
function destroyer(arr) {

  var args = Array.prototype.slice.call(arguments);
  var spliced = args.splice(-(args.length-1), args.length-1);

  var filtered = args.filter(function(){
    return args.indexOf(spliced) === -1;
  });

  return filtered;

  // args = [[1, 2, 3, 1, 2, 3]]
  // spliced = [2, 3]

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
David Kang
@d-kang
Jan 11 2017 00:54
@JLuboff thanks for the heads up!
CamperBot
@camperbot
Jan 11 2017 00:54
d-kang sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:cookie: 600 | @jluboff |http://www.freecodecamp.com/jluboff
Antonious Stewart
@Antonious-Stewart
Jan 11 2017 00:55

soo i cant get this pass var randomNumberBetween0and19 = Math.floor(Math.random() * 20);

function randomWholeNum() {

// Only change code below this line.
Math.floor(Math.random() * 10);
return Math.random();
}

Jason Luboff
@JLuboff
Jan 11 2017 00:56
@Astewart400 Shouldn't you be returning the line before?
Antonious Stewart
@Antonious-Stewart
Jan 11 2017 00:57
that is how the example was setup but i can give it a try
Jason Luboff
@JLuboff
Jan 11 2017 00:58
@Astewart400 Currently your returning a number between 0 and 1. And your code above that is between 0 and 10 is not being used
FreeHandz
@FreeHandz
Jan 11 2017 01:00

hey guys, can u help me with the mutation challenge?
<
function mutation(arr) {
arr[0] = arr[0].toUpperCase();
arr1 = arr1.toUpperCase();
for (i = 0; i < arr1.length; i++) {
if (arr[0].indexOf(arr[1][i]) === -1) {
return false;
}
else {
return true;
}
}
}
>

It's only make a bug, when it's the ["hello", "hey"] case

Greg Duncan
@GregatGit
Jan 11 2017 01:00
@Zaluth try using an ele parameter inside the function to help clarify what you want filtered
@Zaluth so var filtered = args.filter(function(ele)
Almas
@AlmasJush
Jan 11 2017 01:02
can anyone help me with Profile Lookup challenge?
Moisés Man
@moigithub
Jan 11 2017 01:02
@Zaluth if u add a , 1 to ur slice.call (as second parameter to slice)
u can delete the splice line
Almas
@AlmasJush
Jan 11 2017 01:02

function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i<contacts.lenght; i++){
for(var j=0; j<contacts[i].length; j++){

if(firstName === contacts[i][j].firstName && prop === contacts[i][j].prop){
return contacts[prop];
}
else if (firstName != contacts[i][j].firstName){
return "not such contact"; }

else if (prop != contacts[i][j].prop){
return "no such property";}
}
}

Diego Mayer
@Chrono79
Jan 11 2017 01:03
@AlmasJush contacts[i] is an object, not an array
Moisés Man
@moigithub
Jan 11 2017 01:04
@Zaluth also args contain NOT only the array.. but the whole arguments
if u want the array only.. just use ur argument arr instead
FreeHandz
@FreeHandz
Jan 11 2017 01:06
I think i have a bug, guys, with the mutations challenge. everything is correct in my code
can somebody check out for me, please
Moisés Man
@moigithub
Jan 11 2017 01:06
@AlmasJush also have length and lenght
Antonious Stewart
@Antonious-Stewart
Jan 11 2017 01:06
ok so let me see if understand u right @JLuboff the setup line is between 0-9 @ but when i add return math.floor(math.random()*10; it multiples the 0-9 to 0-19 right

@JLuboff i got the code to work with this var randomNumberBetween0and19 = Math.floor(Math.random() * 20);

function randomWholeNum() {

// Only change code below this line.

return Math.floor(Math.random() * 10) ;

Moisés Man
@moigithub
Jan 11 2017 01:08
@Astewart400 if u not sure what each commands does.. better check the documentation
what Math.random does ( mdn.io/Math.random )
and what Math.floor does ( mdn.io/Math.floor )
then.. u (probably) can understand what the whole thing is doing
Almas
@AlmasJush
Jan 11 2017 01:09
@Chrono79 should i do contacts.i.j.firstName?
Greg Duncan
@GregatGit
Jan 11 2017 01:09
@Zaluth also just use arr that will give you [1, 2, 3, 1, 2, 3]
Antonious Stewart
@Antonious-Stewart
Jan 11 2017 01:09
@moigithub ok i will
Diego Mayer
@Chrono79
Jan 11 2017 01:10
@AlmasJush no, you just need only one loop and you can't access an array element with dot notation
Edgar Pan
@edgaryp
Jan 11 2017 01:14
Hi, need help why my code is not working?
function bouncer(arr) {

  function falsy(item) {
    return item !== Boolean;
  }

  return arr.filter(falsy);

}

bouncer([7, "ate", "", false, 9]);
DongjoonLim
@DongjoonLim
Jan 11 2017 01:15
Oh my god I don't know where to start
babajide odusola
@cesarecaravaggio
Jan 11 2017 01:16
I need help PLEASE PLEASE PLEASE

var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
  ];
var myMusic1=[   
  {
  "artist": "Fela Kuti",
  "title": "zombie",
    "release_year": "1076",
    "formats": [
      "CS",
      "LP"],
    "gold": true
  }


  // Add record here
];
Almas
@AlmasJush
Jan 11 2017 01:16
@Chrono79 i am really having a hard time because don't know how to loop through it
Diego Mayer
@Chrono79
Jan 11 2017 01:18
@AlmasJush use a loop with contacts, that is an array, then test or access properties of contacts[i], that's an object
@cesarecaravaggio you have to add a second object on the array myMusic, not create another var
babajide odusola
@cesarecaravaggio
Jan 11 2017 01:21
@Chrono79 it keeps telling me its xpecting[] to match from line 2 everytime i do that..
Gamal9
@Gamal9
Jan 11 2017 01:22

i have that bug "abTest(-2,2) should return undefined
abTest(2,-2) should return undefined" and my code "function abTest(a, b) {

if(a<0||b<0)
{
return "undefined";

}

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

aroojmumtaz
@aroojmumtaz
Jan 11 2017 01:22
can someone please tell me whats wrng with my code

var Car = function(wheels, seats, engines) {
//Change this constructor
this.wheels = 4;
this.seats = 5;
this.engines = 1;
};

//Try it out here
var myCar = new Car(3, 1, 2);

ake Unique Objects by Passing Parameters to our Constructor question

Now give it a try yourself! Alter the Car constructor to use parameters to assign values to the wheels, seats, and engines properties.

Then call your new constructor with three number arguments and assign it to myCar to see it in action.

Stephen James
@sjames1958gm
Jan 11 2017 01:22
@aroojmumtaz You need to use the parameters inside the constructor
Diego Mayer
@Chrono79
Jan 11 2017 01:23
@cesarecaravaggio show how you tried to do what I told you then
Stephen James
@sjames1958gm
Jan 11 2017 01:23
@aroojmumtaz Use wheels, seats and engines to set the values
aroojmumtaz
@aroojmumtaz
Jan 11 2017 01:23
i did
Diego Mayer
@Chrono79
Jan 11 2017 01:23
@Gamal9 "undefined" is not the same as undefined
Stephen James
@sjames1958gm
Jan 11 2017 01:23
@Gamal9 "undefined" is a string you are supposed to return the value undefined
aroojmumtaz
@aroojmumtaz
Jan 11 2017 01:23
var Car = function(wheels, seats,engines)
Stephen James
@sjames1958gm
Jan 11 2017 01:24
@aroojmumtaz this.wheels = wheels -
aroojmumtaz
@aroojmumtaz
Jan 11 2017 01:24
i dont understand.
i think the question tells us NOT to use this.
Stephen James
@sjames1958gm
Jan 11 2017 01:24
@aroojmumtaz Inside the function use the parameters to set the values
aroojmumtaz
@aroojmumtaz
Jan 11 2017 01:25
havent i already done that?
Stephen James
@sjames1958gm
Jan 11 2017 01:25
@aroojmumtaz It specifically tells you TO do this. Alter the Car constructor to use parameters
aroojmumtaz
@aroojmumtaz
Jan 11 2017 01:25

var Car = function(wheels, seats, engines) {
//Change this constructor
this.wheels = 4;
this.seats = 5;
this.engines = 1;
};

//Try it out here
var myCar = new Car(3, 1, 2);

Stephen James
@sjames1958gm
Jan 11 2017 01:26
@aroojmumtaz this.wheels = 4 isn't using the parameter wheels
Gamal9
@Gamal9
Jan 11 2017 01:26
what are undefined values ?
@sjames1958gm
Stephen James
@sjames1958gm
Jan 11 2017 01:26
@Gamal9 undefined is a value itself
babajide odusola
@cesarecaravaggio
Jan 11 2017 01:26
@Chrono79
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }

  {
    "artist":"Fela Kuti",
  "title": "zombie",
    "release_year": 1976,
    "formats": [
      "CS",
      "LP"],
    "gold": true
  }
];
Gamal9
@Gamal9
Jan 11 2017 01:26
@sjames1958gm so what should i return ?
Stephen James
@sjames1958gm
Jan 11 2017 01:26
@Gamal9 undefined
which is different than "undefined"
Diego Mayer
@Chrono79
Jan 11 2017 01:27
@cesarecaravaggio how do you separate array elements?
Almas
@AlmasJush
Jan 11 2017 01:27
@Chrono79 i think my return statement also not correct, right
Gamal9
@Gamal9
Jan 11 2017 01:27
ohhhhhhhh @sjames1958gm thanks a lot i was not know that
CamperBot
@camperbot
Jan 11 2017 01:27
gamal9 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5274 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jan 11 2017 01:27
@Gamal9 :) - now you know that.
Diego Mayer
@Chrono79
Jan 11 2017 01:28
@AlmasJush no, they're not ok
Almas
@AlmasJush
Jan 11 2017 01:28
Thank you @Chrono79
CamperBot
@camperbot
Jan 11 2017 01:28
almasjush sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 3107 | @chrono79 |http://www.freecodecamp.com/chrono79
Gamal9
@Gamal9
Jan 11 2017 01:28
yeh thank u @sjames1958gm :smile:
CamperBot
@camperbot
Jan 11 2017 01:28
gamal9 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: gamal9 already gave sjames1958gm points
Almas
@AlmasJush
Jan 11 2017 01:28
i think i need to continue tomorrow.
babajide odusola
@cesarecaravaggio
Jan 11 2017 01:29
@Chrono79 ty ur the man.
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  },

  {
    "artist":"Fela Kuti",
  "title": "zombie",
    "release_year": 1976,
    "formats": [
      "CS",
      "LP"],
    "gold": true
  }
];
CamperBot
@camperbot
Jan 11 2017 01:29
cesarecaravaggio sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 3108 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jan 11 2017 01:30
:+1:
Danilo Geronimo
@danilogeronimo
Jan 11 2017 01:36
@edgaryp check the item first and then return it
Adam
@adamakers
Jan 11 2017 01:48
I’m having a hard time understanding prototypes in chapter 6 of EloquentJS. I have this snippet that confuses the hell out of me and was hoping someone could talk me through it
http://codepen.io/MrAdam/pen/zNrdRG?editors=0012
actually I think I might understand now. Is the Object.prototype the main “template” (bad wording) for all objects in this example. Meaning any objects prototype will be Object.prototype? so im just assigning a new property to those objects?
Greg Duncan
@GregatGit
Jan 11 2017 01:54
@adamakers this is my understanding - proto is part of object that is not created when you make a new object - so if you create a new array called myArr a property is attatched to that myArray is length - it is not part of the proto - but all those methods accociated with array are not attatched to myArr but are belong to the proto - which you can access using myArr or Array.
Robo Hobo
@RoboHobo085
Jan 11 2017 01:54
HI just wondering about local and global variables. does the local variable take precedence because when it's called it reassigns the variable.
Greg Duncan
@GregatGit
Jan 11 2017 01:56
@RoboHobo085 basically yes - there is a thing call scope chain that you can learn - it's a quite confusing at first
kevinliu6102
@kevinliu6102
Jan 11 2017 02:00
On the Steamroller algorithm challenge, I'm getting the right outputs but none of the tests are displaying as passed. Am I doing something wrong?

var container = [];

function steamrollArray(arr) {
  for (var i = 0; i < arr.length; i++) {
    if (Array.isArray(arr[i])) {
      steamrollArray(arr[i]);
    } else {
      container.push(arr[i]);
    }
  }
  arr = container;
  return arr;
}


steamrollArray([[["a"]], [["b"]]]);
DavidMinAZ
@DavidMinAZ
Jan 11 2017 02:01
@forkerino And I fixed that sorting now, after getting your Object.keys() suggstion to work... but now I've broken something again because it was only showing 3 results but when I added the .sort() using the index properties the array is properly ordered in console but it's not moving anywhere beyond that conversion in the code
Stephen James
@sjames1958gm
Jan 11 2017 02:01
@kevinliu6102 FCC does not work with globals - they don't get reset between tests.
Adam
@adamakers
Jan 11 2017 02:02
@GregatGit man, that kind of broke my brain
Bojan Lazic
@kibs21k
Jan 11 2017 02:04
Hi there can someone explain me why this isn't valid

// 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");

Joseph
@revisualize
Jan 11 2017 02:05
@kibs21k Dot Notation is converting the value to a string (string literal). Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. Example: var num = 42; myObj[num];
Bojan Lazic
@kibs21k
Jan 11 2017 02:05
result = lookup.val; doesn't work but lookup[val] does
Joseph
@revisualize
Jan 11 2017 02:05
Correct.
Cal-culator
@Cal-culator
Jan 11 2017 02:05
Anyone done with Wikipedia Viewer using JS instead of JQuery?
I need help
Bojan Lazic
@kibs21k
Jan 11 2017 02:05
How did u manage to answer me that fast :O
Joseph
@revisualize
Jan 11 2017 02:05
@kibs21k I'm lazy.
Bojan Lazic
@kibs21k
Jan 11 2017 02:05
Thanks for help !
kevinliu6102
@kevinliu6102
Jan 11 2017 02:06
@sjames1958gm bummer. thanks for the tip. now i have to figure this out :(
CamperBot
@camperbot
Jan 11 2017 02:06
kevinliu6102 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5275 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Bojan Lazic
@kibs21k
Jan 11 2017 02:06
Joseph you answerd me at speed of light
:D
Ayush Bahuguna
@relentless-coder
Jan 11 2017 02:06
hello, I have an array of strings that and I have to use each string in a get request. how do I do that? I know that using for and .forEach would return the data for the last string in the array.
Joseph
@revisualize
Jan 11 2017 02:06
@kibs21k I copied and pasted. I'm lazy
Greg Duncan
@GregatGit
Jan 11 2017 02:07
for a deeper looking at your object use chrome's console @adamakers
Bojan Lazic
@kibs21k
Jan 11 2017 02:07
still I saw your answer as I pasted my question I tought it was bot answering me ;D
Joseph
@revisualize
Jan 11 2017 02:07
I'm not a bot.
Maybe a bit of a jerkface.
But not a bot.
Bojan Lazic
@kibs21k
Jan 11 2017 02:08
:)) anyways thanks for the help
eeflores
@eeflores
Jan 11 2017 02:08
eightball is revisualize a bot?
CamperBot
@camperbot
Jan 11 2017 02:08
@eeflores :8ball: outlook not so good :sparkles:
eeflores
@eeflores
Jan 11 2017 02:08
confirmed
Joseph
@revisualize
Jan 11 2017 02:08
eightball is @revisualize a jerkface?
CamperBot
@camperbot
Jan 11 2017 02:08
@revisualize :8ball: my reply is no :sparkles:
Joseph
@revisualize
Jan 11 2017 02:08
DAMN IT!
Greg Duncan
@GregatGit
Jan 11 2017 02:10
@adamakers you have added to the proto
Adam
@adamakers
Jan 11 2017 02:10
@GregatGit hmmm… the interitance thing is making a little sense now
Greg Duncan
@GregatGit
Jan 11 2017 02:10
proto.JPG
Adam
@adamakers
Jan 11 2017 02:11
@GregatGit and i see what you mean about the methods being in the proto
Cal-culator
@Cal-culator
Jan 11 2017 02:11
@GregatGit I still haven't figured out a solution
Ayush Bahuguna
@relentless-coder
Jan 11 2017 02:11
I have set up an http GET service, and in the url, I need to pass an array of strings one at a time. how do I do that? I know that for and forEach won' t work.
Greg Duncan
@GregatGit
Jan 11 2017 02:12
@adamakers I highly recommend going through this guys course - I ended up paying $15 for the rest https://www.youtube.com/watch?v=Bv_5Zv5c-Ts
Cal-culator
@Cal-culator
Jan 11 2017 02:13
Why is it that the code works for Open weather API but when I tried a similar algorithm for Wikipedia, it fails
Adam
@adamakers
Jan 11 2017 02:13
@GregatGit yea, I might have to pick that up
Greg Duncan
@GregatGit
Jan 11 2017 02:14
@adamakers check out the free youtube stuff to see if you like it
Adam
@adamakers
Jan 11 2017 02:14
eloquent JS is just too damn confusing
DavidMinAZ
@DavidMinAZ
Jan 11 2017 02:18
@someone What could be halting my code at a variable declaration? Below, everything works fine through var thumbURL = ...
  for (var j = 0; j < resultsArray.length; j++) {
    var title = resultsArray[j].title;
    var text = resultsArray[j].extract;
    var link = resultsArray[j].pageid;
    console.log("Before thumbnail with j value of " + j);
    console.log(resultsArray);
    var thumbURL = resultsArray[j].thumbnail.source;
    console.log("Loop through resultsArray with j value of " + j);
    buildResultsLayout(title, text, link, thumbURL);
  }
};
But that's where it stops
Johnny
@JohnnyBizzel
Jan 11 2017 02:24
@DavidMinAZ there is no source property?
Bojan Lazic
@kibs21k
Jan 11 2017 02:25
@Adam did you read javascript the good parts?
Adam
@adamakers
Jan 11 2017 02:27
@kibs21k no, i started off with Jon Ducketts JS and jQuery. I think I might go to YDKJS next
Zak
@zaksanderford
Jan 11 2017 02:29
Was the purpose of the Return Largest Numbers in Arrays exercise to write our own sorting algorithm? I have a solution that meets the technical requirements using built-ins, but I am not sure if that is the spirit of the exercise.
Bojan Lazic
@kibs21k
Jan 11 2017 02:29
What’s it like? And how familiar are you with JS in general? I’m trying to find a good ways to improve :)
JavaScript good parts is not for begginers but if your ok with JS it will guide you the right path I think, because I doesn’t teach you bad practice and feature of languge that you shouldn’t use. They call them footgun :)
The guy who wrote is also founder of JSON and JS linter :) So I think it just can’t be a bad thing to read :)
Adam
@adamakers
Jan 11 2017 02:32
Jon Duckett’s Book? It’s good for the very beginner. He creates visuals that really drive home the topics
I’ve been working on JS for a couple months now, but still consider myself a beginner. Im close to being done with my tictactoe game
DavidMinAZ
@DavidMinAZ
Jan 11 2017 02:34
@JohnnyBizzel Hmm... it was working fine before I did a .sort() on the array, though. Maybe it is empty on the first one in the sorted array.
Bojan Lazic
@kibs21k
Jan 11 2017 02:34
I get the basic concepts and stuff but I’ve nevered tried my self any deeper, should I check the book ? :) Or it will teach me almost everything I’ve learned here at codecamp?
Johnny
@JohnnyBizzel
Jan 11 2017 02:35
@DavidMinAZ Check in the debugger
Adam
@adamakers
Jan 11 2017 02:35
@kibs21k I would say pass on it. It teaches the very basics. If you’ve already gone through the JS basics on FCC you’ve gone through a lot of what’s in Ducketts book. Like I said, its very basic
Johnny
@JohnnyBizzel
Jan 11 2017 02:36
@kibs21k Just keep writing code. That's the best way to learn.
Bojan Lazic
@kibs21k
Jan 11 2017 02:36
Okej thanks :)
DavidMinAZ
@DavidMinAZ
Jan 11 2017 02:36
@JohnnyBizzel I had the array output to the console and it turns out that the sorted array's first object doesn't have the property after all
Jerry Purvis
@MessiaHack
Jan 11 2017 02:37
$(".btn-0").click(function() {
    $(".day-0-cast").toggle(1000)
})

$(".btn-1").click(function() {
    $(".day-1-cast").toggle(1000)
})

$(".btn-2").click(function() {
    $(".day-2-cast").toggle(1000)
})

$(".btn-3").click(function() {
    $(".day-3-cast").toggle(1000)
})

$(".btn-4").click(function() {
    $(".day-4-cast").toggle(1000)
})

$(".btn-5").click(function() {
    $(".day-5-cast").toggle(1000)
})
how can I refactor this down into one function rather than its current form?
I tried a for loop, but then nothing worked
DavidMinAZ
@DavidMinAZ
Jan 11 2017 02:38
@JohnnyBizzel Putting in an "if" might fix that, but is there a better way?
Moisés Man
@moigithub
Jan 11 2017 02:39
@MessiaHack how the html part of those elements looks like ?
Johnny
@JohnnyBizzel
Jan 11 2017 02:40
@DavidMinAZ Hard to say without knowing the contents of the Array
Jerry Purvis
@MessiaHack
Jan 11 2017 02:40
babajide odusola
@cesarecaravaggio
Jan 11 2017 02:41
whats this statement do?
ourArray.push(i)
Bojan Lazic
@kibs21k
Jan 11 2017 02:41
By the way does anyone of you use CoffeScript?
Johnny
@JohnnyBizzel
Jan 11 2017 02:42

@MessiaHack

$(".btn-" + x).click(function() {
    $(".day-" + x + "-cast").toggle(1000)
})

where x is the number

Jerry Purvis
@MessiaHack
Jan 11 2017 02:42
@JohnnyBizzel lol I already do that
ctcrnitv
@ctcrnitv
Jan 11 2017 02:42
can someone please help me with this code?
Johnny
@JohnnyBizzel
Jan 11 2017 02:43
@cesarecaravaggio adds an item to an array
http://www.w3schools.com/jsref/jsref_push.asp
ctcrnitv
@ctcrnitv
Jan 11 2017 02:43
it's line 77 of store.js
I mean sales.js*
kaon313
@kaon313
Jan 11 2017 02:47

Hey guys and gals ! I'm learning Javascript , and currently stuck.

"Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator."

var remainder; 11 % 3 = 2; is what I've been putting
Joseph
@revisualize
Jan 11 2017 02:48
@kaon313 what is the value of num = 4 + 3;
Bojan Lazic
@kibs21k
Jan 11 2017 02:48
@kaon313 try using 11 % 4
kaon313
@kaon313
Jan 11 2017 02:49
@revisualize 7, right?
Joseph
@revisualize
Jan 11 2017 02:49
@kaon313 what is the value of num = 10 / 2;
Johnny
@JohnnyBizzel
Jan 11 2017 02:50
5
:five:
Joseph
@revisualize
Jan 11 2017 02:50
% is just another operator.
Remainder:
http://images.tutorvista.com/cms/images/38/remainder1.PNG
13 % 2 is 1 ... 26 % 5 is 1 ... 24 % 6 is 0
24 % 5 is 4 ... 219 % 20 is 19 ... Does that help?
kaon313
@kaon313
Jan 11 2017 02:50
@kibs21k nope, nothing.
Bojan Lazic
@kibs21k
Jan 11 2017 02:51
It should be var reminder = 11 % 3 ;
Moisés Man
@moigithub
Jan 11 2017 02:51
$(".btn").click(function() {
    $(this).parent().next().toggle(1000)
})
@MessiaHack
if ur html structure are similar on all ur buttons... that should work
Bojan Lazic
@kibs21k
Jan 11 2017 02:51
I think right guys?
Joseph
@revisualize
Jan 11 2017 02:51
@kibs21k can you explain why?
Zaluth
@Zaluth
Jan 11 2017 02:52
how do i use regex to match anything that's not alphanumeric or a whitespace? i tried /\W\s/g but in "Hamburgers < Pizza < Tacos" it returns ["< "]
Bojan Lazic
@kibs21k
Jan 11 2017 02:52
Because it says set reminder to be equal to 11 divieded by 3 using the remainder %
kaon313
@kaon313
Jan 11 2017 02:52
@kibs21k THAT WAS IT !!!
Joseph
@revisualize
Jan 11 2017 02:52
@kaon313 do you understand why?
kaon313
@kaon313
Jan 11 2017 02:52
I went wrong by adding " = 2 "
Bojan Lazic
@kibs21k
Jan 11 2017 02:52
yeah :D
kaon313
@kaon313
Jan 11 2017 02:52
@revisualize yes
Joseph
@revisualize
Jan 11 2017 02:53
Variable assignment and reassignment onky uses the assignment operator once.
The right of the assignment operator gets assigned to the left.
Jerry Purvis
@MessiaHack
Jan 11 2017 02:55
@moigithub what does .parent and .next do?
Margaret
@Margaret2
Jan 11 2017 02:55
@Zaluth well, < is not a letter or a number and it's not whitespace, so...
seems like your match is working alright :D
kaon313
@kaon313
Jan 11 2017 02:55
I appreciate the help !! Tahnks !!
Zaluth
@Zaluth
Jan 11 2017 02:56
@Margaret2 but it's matching the space after the <
Margaret
@Margaret2
Jan 11 2017 02:56
maybe \S instead of \s
S7eve
@S7eve
Jan 11 2017 02:56
@zaksanderford so that you know how to do it without a built-ins
Bojan Lazic
@kibs21k
Jan 11 2017 02:57
@kaon313 your welcome :)
Zaluth
@Zaluth
Jan 11 2017 02:57
@Margaret2 now it matches the space before haha
Margaret
@Margaret2
Jan 11 2017 02:57
O.o
Zaluth
@Zaluth
Jan 11 2017 02:57
it's the Convert HTML Entities challenge
function convertHTML(str) {
  var regex = /\W\S/g;
  var search = regex.exec(str);

  return search;
}


convertHTML("Hamburgers < Pizza < Tacos");
Jerry Purvis
@MessiaHack
Jan 11 2017 02:58
@moigithub, I think I understand what's happening. when I click the button, parent goes to the element above, then next tells it to go to the next element where it was clicked, and perform the requested function, in this case, toggle that element. Is that correct?
Margaret
@Margaret2
Jan 11 2017 02:59
@Zaluth how about [^\w\s]
^ means nothing inside brackets
@Zaluth i think when i did that one i just did a series of replace statements for each individual symbol :D
Zaluth
@Zaluth
Jan 11 2017 03:01
@Margaret2 now the result is null. well, i know there are easier ways, but i wanted to use regex :p
Margaret
@Margaret2
Jan 11 2017 03:01
yeah, .replace() uses a regex, like .replace(/&/, "&amp;");
not as efficient tho of course
than if you had a single regex i guess
Zaluth
@Zaluth
Jan 11 2017 03:02
@Margaret2 i'll give it a try here, thanks
CamperBot
@camperbot
Jan 11 2017 03:02
zaluth sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
:star2: 1129 | @margaret2 |http://www.freecodecamp.com/margaret2
Yi
@ycoding007
Jan 11 2017 03:13

Hi, everyone,i gotta a question about Caesars Cipher challenge

function rot13(str) {

  var regExp = /[A-Za-z]/g;
  str.toUpperCase();
  var tempArr = str.split('');
  for(var i = 0;i<tempArr.length;i++) {
    if (tempArr[i].match(regExp)) { // make sure it's alphabetic
      tempArr[i] = tempArr[i].charCodeAt(); //transform to integer
      tempArr[i] = tempArr[i] +13; //shift 13 integer
      tempArr[i] = String.fromCharCode(tempArr[i]);  //transform back to alphabetic 
     }
  str = tempArr.join(' ');
  }
  return str;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");

after run, i got
`R_ _ ]o^_ ] [ g P

what's wrong?
DavidMinAZ
@DavidMinAZ
Jan 11 2017 03:14
@JohnnyBizzel Thanks for the help on spotting that one. Still struggling with it... array contains part of JSON response from the Wikipedia API
CamperBot
@camperbot
Jan 11 2017 03:14
davidminaz sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1113 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
DavidMinAZ
@DavidMinAZ
Jan 11 2017 03:16
@JohnnyBizzel However, "thumbnail" doesn't seem to be recognized by .hasOwnProperty(thumbnail) when I try to segregate that variable declaration using an if
@JohnnyBizzel It's definitely a property in some of the objects in the array so I'm a bit baffled.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:17
@ycoding007 you cant just add to all the letters you add 13 to the first half of the alphabet and subtract 13 form the second half
simonekj
@simonekj
Jan 11 2017 03:18
Hey can someone help me on the make object properties private challenge. I'm not sure how to write a function in getGear to make setGear return the numbers put in.

var Car = function() {
// this is a private variable
var speed = 10;

// these are public methods
this.accelerate = function(change) {
speed += change;
};

this.decelerate = function() {
speed -= 5;
};

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

var Bike = function() {

// Only change code below this line.
var gear;

this.getGear = function() {

};
this.setGear = function() {
return gear;
};
};

var myCar = new Car();

var myBike = new Bike();
myBike.getGear(1);

HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:18
and theres not need to make sure its non alphanumeric, youre going to remove the spaces like that @ycoding007
function example(test) {
str = test;
}
everytime you run this function it would make str = test @simonekj
James Shore
@Jimbobmahooley
Jan 11 2017 03:20
Hi I was wondering if there is something similar to .hasOwnProperty that instead checks for the information of the property instead of the property itself thanks in advance
if someone could help me with this I'd really appreciate it
AntyElean
@AntyElean
Jan 11 2017 03:22
hey can anyone tell me whats wrong with my code? var "entreeValue"["an entree"]; // hamburger
var "drinkValue"["the drink"]; // water
ctcrnitv
@ctcrnitv
Jan 11 2017 03:22
trying to add an empty cell into the DOM, see last line of function printStoreHours()
AntyElean
@AntyElean
Jan 11 2017 03:22
var "entreeValue"["an entree"]; // hamburger
var "drinkValue"["the drink"]; // water
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:22
hasOwnProperty does check for the property itself @Jimbobmahooley
James Shore
@Jimbobmahooley
Jan 11 2017 03:23
@HeebieGeeBee I want something to check for the value of the property
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:24
then you just access the property
Bojan Lazic
@kibs21k
Jan 11 2017 03:24
@HeebieGeeBee I think It only check if it exist it gives you true or false value
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:24
yeah i dont get what want
you want to return the property?
Bojan Lazic
@kibs21k
Jan 11 2017 03:25
@AntyElean you don’t need “” with var
@AntyElean just var enterValue[“an entree”]
var entreeValue["an entree"]; // hamburger
var drinkValue["the drink"]; // water
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:26
give an example of what you want @Jimbobmahooley
AntyElean
@AntyElean
Jan 11 2017 03:27
var entreeValue["an entree"]; // hamburger
var drinkValue["the drink"]; // water
This was wrong @kibs21k
James Shore
@Jimbobmahooley
Jan 11 2017 03:27
@HeebieGeeBee I am given the value of a property in a parameter and I want to see if that value exists in any property within the object
@HeebieGeeBee https://www.freecodecamp.com/challenges/profile-lookup#?solution=%0A%2F%2FSetup%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0A%0A%0Afunction%20lookUpProfile(firstName%2C%20prop)%7B%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0Aif%20(contacts.hasOwnProperty)%0A%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Change%20these%20values%20to%20test%20your%20function%0AlookUpProfile(%22Akira%22%2C%20%22likes%22)%3B%0A
Bojan Lazic
@kibs21k
Jan 11 2017 03:27
@AntyElean Can you tell me what’s the name of execrise?
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:28
var entreValue needs to equal something @AntyElean
AntyElean
@AntyElean
Jan 11 2017 03:28
Accessing Objects Properties with Bracket Notation
@kibs21k
Moisés Man
@moigithub
Jan 11 2017 03:28
     <div class="title day-5-title">
            <button class="btn"><span class="day5"></span></button>
    </div>
    <div class="forecast day-5-cast">
                    <span class="day-5-icon"></span>
                    <p><span class="temp day-5-temp"></span></p>
                    <p><span class="cond day-5-cond"></span></p>
    </div>
$(".btn").click(function() {
    $(this).parent().next().toggle(1000)
})
@MessiaHack
this is the button
parent of this is div.title
next is the sibling of title.. div.forecast .. and to this toggle() is applied
Bojan Lazic
@kibs21k
Jan 11 2017 03:29
Ahh I see
we have a testObj
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:29
@Jimbobmahooley first off you'll need to create a loop to loop through each contacts object
Bojan Lazic
@kibs21k
Jan 11 2017 03:29
So it should be like this:
var entreeValue = testObj['an entree']; // Change this line
var drinkValue = testObj['the drink']; // Change this line
we need to use object up there we just asigne the value to left
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:30
if you want to return the value of a 'prop', you would just say something like return contacts[prop]
@Jimbobmahooley
James Shore
@Jimbobmahooley
Jan 11 2017 03:30
@HeebieGeeBee and the loop checks it against the value I've been given?
AntyElean
@AntyElean
Jan 11 2017 03:30
the equal sign was wrong and the example also doesnt have one @HeebieGeeBee
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:31
no the loop will create a loop of numbers so you can do contacts[i] and that will loop through and access contact[0] then contact[1] etc etc
James Shore
@Jimbobmahooley
Jan 11 2017 03:32
oh okay thanks I will start with that then @HeebieGeeBee
CamperBot
@camperbot
Jan 11 2017 03:32
:cookie: 515 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
jimbobmahooley sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:32
you cant just say var entreeValue['an entree'] you need to make entreeValue equal something
Bojan Lazic
@kibs21k
Jan 11 2017 03:32
@AntyElean Example doesn’t have an equal sign because they are just checking the value your giving it to the new var
you need to create var entreeValue and asign testObj['an entree’] to it
sup-gaurav
@sup-gaurav
Jan 11 2017 03:34
Suppose the
paragraph above has been assigned to the variable text.
1 for (var i = 0; i < text.length; i++) {
2 if (text.slice(i, i + 12) === "World War II") {
3 text = text.slice(0, i) + "the Second World War" + text.slice(i + 12);
can somebody explain me the last line
AntyElean
@AntyElean
Jan 11 2017 03:34
so if the var entreeValue isnot equal to ['an entree'] how would I write it
sup-gaurav
@sup-gaurav
Jan 11 2017 03:34
i understand the looping part
but couldnt understand the last line
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:35
youre not doing a comparison with = youre making a variable stand for something
Bojan Lazic
@kibs21k
Jan 11 2017 03:35
@AntyElean Well in the example they tell you you need to set the property of object to entreeValue
like this
var entreeValue = testObj['an entree'];
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:36
what dont you understand about it?
its making text equal a very odd string
DavidMinAZ
@DavidMinAZ
Jan 11 2017 03:36
@JohnnyBizzel If you have a moment to check my pen this is where the problem is... line 40-ish of the JS http://codepen.io/dmattiuz/pen/xgwoav?editors=0011
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:36
@sup-gaurav
AntyElean
@AntyElean
Jan 11 2017 03:37
@HeebieGeeBee @kibs21k I understand it now. Thank you!!!
CamperBot
@camperbot
Jan 11 2017 03:37
antyelean sends brownie points to @heebiegeebee and @kibs21k :sparkles: :thumbsup: :sparkles:
:cookie: 245 | @kibs21k |http://www.freecodecamp.com/kibs21k
:cookie: 516 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Bojan Lazic
@kibs21k
Jan 11 2017 03:37
@AntyElean your welcome :)
sup-gaurav
@sup-gaurav
Jan 11 2017 03:39
the purpose is replacing the world war 2 to the the secound world war and the 3 line is supposed to do that , i dont understand what text.slice(0, i) is doinf here
@sup-gaurav
Johnny
@JohnnyBizzel
Jan 11 2017 03:39
@DavidMinAZ Not every article provides a thumbnail, test for it's existence first
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:39
well its not doing that @sup-gaurav
well i guess it might actually
sup-gaurav
@sup-gaurav
Jan 11 2017 03:41
then whats going to be the correct format to do that #HeebieGeeBee
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:41
yeah it is its making the string have become the text before world war 2 then adding second world war and adding the rest of the text on the end
sorry it does do that
sup-gaurav
@sup-gaurav
Jan 11 2017 03:43
@HeebieGeeBee so text.slice(0, i) its removing the world war 2 text?
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:44
no its cutting out all the text out before world war 2
Alex
@Joshua-A-Smith
Jan 11 2017 03:44
function nextInLine(arr, item) {
arr.push(item);// Your code here

  return item.shift(arr);  // Change this line
}
How is this wrong?
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:45
and text.slice(i + 12) cuts out all the words before world war 2 and including world war 2
return item.shift(arr) this is not what you want to be doing @Joshua-A-Smith
babajide odusola
@cesarecaravaggio
Jan 11 2017 03:46
@Joshua-A-Smith try shifting without "arr" in parenthesis...
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:46
dont try that
sup-gaurav
@sup-gaurav
Jan 11 2017 03:46
wow solves the mystery for me , thanx a ton for explaining tat @HeebieGeeBee
CamperBot
@camperbot
Jan 11 2017 03:46
sup-gaurav sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 517 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
babajide odusola
@cesarecaravaggio
Jan 11 2017 03:46
nvm @HeebieGeeBee is right lol.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:46
take arr out the parenthesis yes but you dont want to shift item
Fidela James
@fidela
Jan 11 2017 03:47
how do i define i for generating random fractions with Javascript

function randomFraction() {

// Only change code below this line.
while(i<=0 && i<=1){
Math.random();
i.push(i++);
}
// Only change code above this line.
}

babajide odusola
@cesarecaravaggio
Jan 11 2017 03:47
right right
Lawanu Borthakur
@Lawanu
Jan 11 2017 03:49

function myLocalScope() {

var myVar="use strict";

console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope

// Now remove the console log line to pass the test

error??
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:49
qhy do you need i<=0 %% i<=1? @fidela not saying that would solve your problem btw just seems weird
Fidela James
@fidela
Jan 11 2017 03:51
I see. I've been moving them around trying to establish range if that was the issue
DavidMinAZ
@DavidMinAZ
Jan 11 2017 03:52

@JohnnyBizzel Tried to do that with this:

if (resultsArray[j].hasOwnProperty(thumbnail)) {
    var thumbURL = resultsArray[j].thumbnail.source;
    }

But I don't seem to be getting the expected result

HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:52
what challenge is that @fidela i dont see what youre using a while loop for
Fidela James
@fidela
Jan 11 2017 03:53
Math.random() function that generates a random decimal number between 0 (inclusive) and not quite up to 1 (exclusive). Thus Math.random() can return a 0 but never quite return a 1.
Instructions
Change randomFraction to return a random number instead of returning 0.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:53
Math.random() just generates a number between 0-1 but not 1 i do believe
Fidela James
@fidela
Jan 11 2017 03:53
Generate Random Fractions with JavaScript
yes never quite. Is that already assumed so I don't have to give the function range?
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:54
yeah so you just need to put Math.random() in the function @fidela
yeah thats just what Math.random() does
Lawanu Borthakur
@Lawanu
Jan 11 2017 03:55

function myLocalScope() {

var myVar="use strict";

console.log(myVar);
}
myLocalScope();
what is the problem with this code?.Can you please tell me?. I am able to pass through Local Scope and Functions challenge.Please help me out.

Fidela James
@fidela
Jan 11 2017 03:55
that's the only check I have after running the test :|
Joseph
@revisualize
Jan 11 2017 03:56
@fidela What is your function?
Mohamed Hajr
@MohamedHajr
Jan 11 2017 03:56

hey guys am having a problem understanding how this algorithm works // Returns a random integer between min (included) and max (included)

function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}

i feel so dump :D
Fidela James
@fidela
Jan 11 2017 03:56
function randomFraction() {
Johnny
@JohnnyBizzel
Jan 11 2017 03:57
@DavidMinAZ I did this in another attempt:
 if (pages[key].thumbnail != undefined){
          $(".image").last().css("background-image","url("+pages[key].thumbnail.source+")");
        }
Joseph
@revisualize
Jan 11 2017 03:57
@fidela Do you have more to that function?
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:58
try just putting return Math.random(); in the function @fidela
Fidela James
@fidela
Jan 11 2017 03:58

function randomFraction() {

// Only change code below this line.
while(i<=0 && i<=1){
Math.random();
i.push(i++);
}
// Only change code above this line.
}

HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:58
whats the name of the challenge?
Dylan Hsiao
@greedylan
Jan 11 2017 03:58
say if have var arr = [5,4,3,2,1] how do I find 5x4x3x2x1 by using for loop?
var product = 0;
var arr= [5,4,3,2,1];
for(var i =0; i<arr.length; i++){
  product =
}
Fidela James
@fidela
Jan 11 2017 03:58
Generate Random Fractions with JavaScript
Joseph
@revisualize
Jan 11 2017 03:58
@fidela Why did you create a while loop?
@fidela Reset the challenge. You just need to return Math.random();
Joseph
@revisualize
Jan 11 2017 03:59
@fidela You are over complicating the challenge.
Fidela James
@fidela
Jan 11 2017 03:59
I assumed it was asking me to
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 03:59
yup
Fidela James
@fidela
Jan 11 2017 03:59
resetting
Joseph
@revisualize
Jan 11 2017 04:00
@fidela Also, What you wrote doesn't work at all.
DavidMinAZ
@DavidMinAZ
Jan 11 2017 04:01
@JohnnyBizzel I switched mine to that style of logic and suddenly it's all working like a charm
Fidela James
@fidela
Jan 11 2017 04:01
return Math.random();
DavidMinAZ
@DavidMinAZ
Jan 11 2017 04:01
@JohnnyBizzel Many thanks!
anweshd
@anweshd
Jan 11 2017 04:01

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

// Only change code below this line;

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

CamperBot
@camperbot
Jan 11 2017 04:01
:warning: davidminaz already gave johnnybizzel points
davidminaz sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:01
@Lawanu you need to just decalre myVar globally then follow the comments in the code
Joseph
@revisualize
Jan 11 2017 04:01
@greedylan you multiply the the array element value.
Clara Mae Wells
@run-cmw
Jan 11 2017 04:01
```

function caseInSwitch(val) {
var answer = "";
// Only change code below this line
case 1:
answer = "alpha";
break;
case 2:
answer = "beta";
break;
case 3:
answer = "gamma";
break;
case 4:
answer = "delta";
break;
// Only change code above this line
return answer;
}

// Change this value to test
caseInSwitch(1);

Johnny
@JohnnyBizzel
Jan 11 2017 04:02
@DavidMinAZ Glad it worked! Your page looks well designed too :+1:
Joseph
@revisualize
Jan 11 2017 04:02
@run-cmw You have no switch. Just a bunch of case statements.
jakobmara
@jakobmara
Jan 11 2017 04:02

function chunkArrayInGroups(arr, size) {
 /* var first = arr.slice(0, size);
  var second = arr.slice(size); */
 var orgin = size;
  var y;
  var newArr = [];
  var x = arr.length;
  var groups = x / size;
  groups = Math.round(groups);
  var extra = x % size;
  for (var i = 0; i < groups; i++){
    var item = arr.slice(y, orgin);//newArr.push(first);
    y += size;
    orgin += size;
    newArr.push(item);
}
  return newArr;

}

chunkArrayInGroups([0, 1, 2, 3, 4, 5,], 2);
when I try to run this it returns the array but what it does is repeats the numbers it goes [0,1], [0,1,2,3],[0,1,2,3,4,5] and I need it to do [0,1], [2,3] [4,5] what is messing up?
DavidMinAZ
@DavidMinAZ
Jan 11 2017 04:02
@JohnnyBizzel Thank you... I was worried it would seem like a code nightmare to others so that's reassuring!
CamperBot
@camperbot
Jan 11 2017 04:02
davidminaz sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:warning: davidminaz already gave johnnybizzel points
Lawanu Borthakur
@Lawanu
Jan 11 2017 04:03
@HeebieGeeBee thanks
CamperBot
@camperbot
Jan 11 2017 04:03
lawanu sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 518 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
anweshd
@anweshd
Jan 11 2017 04:03

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

// Only change code below this line;

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

Joseph
@revisualize
Jan 11 2017 04:03
@anweshd testObj [pl remove the space
Dylan Hsiao
@greedylan
Jan 11 2017 04:03
@revisualize I know that but how do I use var i here?
Clara Mae Wells
@run-cmw
Jan 11 2017 04:03
@revisualize How do I make my code show up like I'm using a text editor. I tried ```
Johnny
@JohnnyBizzel
Jan 11 2017 04:04
@DavidMinAZ Keep up the good work ;)
Mohamed Hajr
@MohamedHajr
Jan 11 2017 04:04

guys do any body understands this formula // Returns a random integer between min (included) and max (included)

function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}

Joseph
@revisualize
Jan 11 2017 04:04
@run-cmw I can give you that info but, it doesn't change my statement.

If you are posting code that is large, Please use Gist - https://gist.github.com/ then please paste the link here.
...
How to do code block format: ..... PLEASE try with a small block of code before you try to make a bigger one.
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code
```js [SHIFT+ENTER]
// your code here
``` [CTRL+ENTER or CMD+ENTER to send]
Please do not confuse `s with 's.
Also note that the ```s need to each be on their own lines
The ` key can usually be found on most keyboards up next to the 1 key.
If you hit SHIFT+` it will give you the ~.
Example:
```
code
```
...
Output:

var code = undefined;

...
You can also do inline code formatting:
A string of text with a `variable` or `other bit of code`.
Output:
A string of text with a variable or other bit of code.

anweshd
@anweshd
Jan 11 2017 04:04
@revisualize not works while removing space
Joseph
@revisualize
Jan 11 2017 04:05
@anweshd What?
@revisualize
Joseph
@revisualize
Jan 11 2017 04:05
@anweshd playerNumber should be a number
jakobmara
@jakobmara
Jan 11 2017 04:05
is anyone able to help me?
Rob
@throb36
Jan 11 2017 04:05
@MohamedHajr Insert 2 numbers into min and max, and do the math.
Joseph
@revisualize
Jan 11 2017 04:05
@anweshd You have it as a string.
Clara Mae Wells
@run-cmw
Jan 11 2017 04:06
Thanks @revisualize
CamperBot
@camperbot
Jan 11 2017 04:06
run-cmw sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2910 | @revisualize |http://www.freecodecamp.com/revisualize
Fidela James
@fidela
Jan 11 2017 04:07
couldn't figure out return math.random; but somehow next challenge made sense :| I don't understand programming :worried:
Mohamed Hajr
@MohamedHajr
Jan 11 2017 04:08
@Rob thats doesn’t explain it ...
Joseph
@revisualize
Jan 11 2017 04:08
@fidela it is Math.random(); not math.random;
Rob
@throb36
Jan 11 2017 04:08
For math random stuff, I usually just put it in a variable. Then return the variable.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:08
@MohamedHajr what dont you understand about it
Fidela James
@fidela
Jan 11 2017 04:09
@revisualize lol thanks. I put in correctly a few minutes ago after a million hints
CamperBot
@camperbot
Jan 11 2017 04:09
fidela sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2911 | @revisualize |http://www.freecodecamp.com/revisualize
Mohamed Hajr
@MohamedHajr
Jan 11 2017 04:10
@HeebieGeeBee how it works ^^
Rob
@throb36
Jan 11 2017 04:10
@MohamedHajr Math.random only returns numbers between 0 and 1. It will return 0, but not 1. If you put 5 into min, and 10 into max, and do the math, you get 11. Math.random * 11 won't EVER get you 11 (because Math.random won't return a 1). Then it's rounded down. So the highest number you'll get is 10.
babajide odusola
@cesarecaravaggio
Jan 11 2017 04:10

sooo i got this right but I dont unerstand what is going on in this for loop.

var myArr = [ 2, 3, 4, 5, 6];
var total=0;
for(var i=0; i<myArr.length; i++){
  total += myArr[i];
}

anyone wanna give me like a quick explanation of why i had to create a var total and what is goiing on with total += myArr? please.

Rob
@throb36
Jan 11 2017 04:11
Total is adding the value of myArr, and setting it to total. The same as total = total + myArr.
James Shore
@Jimbobmahooley
Jan 11 2017 04:11

function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i < contacts.length; i++) {
  if (contacts[i][1] == firstName) {
    if (contacts[i].hasOwnProperty(prop)) {
      return contacts[prop];
    }
    else {
      return "No such property";
    }
    } 
  else {
    return "No such contact";
  }
  }
please can someone please tell whats wrong with this code its in the profile lookup challenge thanks in advance
babajide odusola
@cesarecaravaggio
Jan 11 2017 04:11
did i really have to declare total=0?
Dylan Hsiao
@greedylan
Jan 11 2017 04:11
@jakobmara I am not seeing var i in your for loop?
Rob
@throb36
Jan 11 2017 04:11
@cesarecaravaggio Yeah, you need to declare it if you're going to use it.
babajide odusola
@cesarecaravaggio
Jan 11 2017 04:12
@throb36 ohok
@throb36 ty
CamperBot
@camperbot
Jan 11 2017 04:12
cesarecaravaggio sends brownie points to @throb36 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for throb36
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:12
Math.random() // 0.4 for example
max - min +1 //    13 - 6 + 1 = 8
so 0.4 * 8 = 3.2 
3.2 + 6 = 9.2
math.Floor(9.2) = 9 // a number between max and min
@MohamedHajr
Joseph
@revisualize
Jan 11 2017 04:12
@Jimbobmahooley Your logic.
James Shore
@Jimbobmahooley
Jan 11 2017 04:13
@revisualize Please explain
anweshd
@anweshd
Jan 11 2017 04:13

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

// Only change code below this line;

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

Joseph
@revisualize
Jan 11 2017 04:13
@Jimbobmahooley Side question to change a bit of your logic.
Let's say you were at a big business event and throughout the event you got handed 200 business cards. Now, I walk up to you at the end and ask you.. Do you have a Business Card for "Jane Smith"? Now you loop look through your stack of 200 business cards. When would you tell me that you didn't have a business card for Jane?
Mohamed Hajr
@MohamedHajr
Jan 11 2017 04:13
Guys what i mean is not giving me examples what i mean
Joseph
@revisualize
Jan 11 2017 04:13
@anweshd playerNumber should be a number
@anweshd You have it as a string.
@anweshd Do you understand that ---^^ ?
Mohamed Hajr
@MohamedHajr
Jan 11 2017 04:14
is for instance we substract max - min because we wanna get the width of the interval but why we add +1
James Shore
@Jimbobmahooley
Jan 11 2017 04:14
@revisualize after I've checked all the cards
Mohamed Hajr
@MohamedHajr
Jan 11 2017 04:14
for instance
Joseph
@revisualize
Jan 11 2017 04:14
@Jimbobmahooley So, you're saying that after you loop look through all of the contacts cards in your array of object stack. That you'd tell me you don't have one for the individual?
Dylan Hsiao
@greedylan
Jan 11 2017 04:14
still need help on this. say if have var arr = [5,4,3,2,1] how do I find 5x4x3x2x1 by using for loop?
var product = 0;
var arr= [5,4,3,2,1];
for(var i =0; i<arr.length; i++){
  product =
}
Joseph
@revisualize
Jan 11 2017 04:14
@greedylan You multiply the product by the array element.
@greedylan But, 0 * anything is 0 ... so there is that problem.
jakobmara
@jakobmara
Jan 11 2017 04:15
can someone help me with one of the basic algorithm challenges?
Rob
@throb36
Jan 11 2017 04:15
Loop through the array, and multiply each one, *= each time the loop runs.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:15
@MohamedHajr thats how the formula works, you'll need to ask someones whos better than mathematics than i am
James Shore
@Jimbobmahooley
Jan 11 2017 04:16
@revisualize are you saying my else statement needs to be after my first if statement?
Joseph
@revisualize
Jan 11 2017 04:16
@Jimbobmahooley No.
@Jimbobmahooley
  // code before a for loop.
for (..........) {
  // Code inside of a for loop.
}
  // code after a for loop.
Mohamed Hajr
@MohamedHajr
Jan 11 2017 04:16
@HeebieGeeBee i just need to understands the mathmatics so i can figure out the one for the answer
Rob
@throb36
Jan 11 2017 04:17
@MohamedHajr The +1 pushes the maximum number over by 1. Because math.random will NEVER return a 1.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:17
the answer for that challenge is that formula
Dylan Hsiao
@greedylan
Jan 11 2017 04:17
@revisualize @throb36 thank you sorry I have brain lag...
CamperBot
@camperbot
Jan 11 2017 04:17
greedylan sends brownie points to @revisualize and @throb36 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for throb36
:star2: 2912 | @revisualize |http://www.freecodecamp.com/revisualize
James Shore
@Jimbobmahooley
Jan 11 2017 04:18
@revisualize My if statement needs to be outside and after my for loop
Joseph
@revisualize
Jan 11 2017 04:18
@Jimbobmahooley No.
Mohamed Hajr
@MohamedHajr
Jan 11 2017 04:18
@throb36 @HeebieGeeBee thanks a lot guys
CamperBot
@camperbot
Jan 11 2017 04:18
mohamedhajr sends brownie points to @throb36 and @heebiegeebee :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for throb36
:cookie: 519 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Rob
@throb36
Jan 11 2017 04:18
Did Profile lookup take anyone else fooorrrreeeever to figure out?
Mohamed Hajr
@MohamedHajr
Jan 11 2017 04:18
nah that was east xD
Joseph
@revisualize
Jan 11 2017 04:18
@throb36 It took a while. But, you have to change your logic a bit.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:19
record collection was harder
but theyre nothing compared to what they become in intermediate and advanced
Rob
@throb36
Jan 11 2017 04:19
Yeah, I figure they're only going to get harder.
Joseph
@revisualize
Jan 11 2017 04:20

@Jimbobmahooley Side question to change a bit of your logic.
Let's say you were at a big business event and throughout the event you got handed 200 business cards. Now, I walk up to you at the end and ask you.. Do you have a Business Card for "Jane Smith"? Now you loop look through your stack of 200 business cards. When would you tell me that you didn't have a business card for Jane?

@revisualize after I've checked all the cards

@Jimbobmahooley So, you're saying that after you loop look through all of the contacts cards in your array of object stack. That you'd tell me you don't have one for the individual?

@Jimbobmahooley

  // code before a for loop.
for (..........) {
  // Code inside of a for loop.
}
  // code after a for loop.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:20
i think record collection might have been moved to advanced now though
James Shore
@Jimbobmahooley
Jan 11 2017 04:21
@revisualize I think I understand what your saying but I think my code is doing that can you tell me what my code is actually doing?
Joseph
@revisualize
Jan 11 2017 04:22
@Jimbobmahooley Yeah. Your code is only looping once. Because...
return statements cause functions to halt and return. If you're trying to do a return inside of a loop it will cause the function to halt and return the information that you specify.
James Shore
@Jimbobmahooley
Jan 11 2017 04:24
@revisualize can you not use if statements like I have inside a for loop and do I also need more loops?
Caroline Dunn
@cdunn0529
Jan 11 2017 04:24
Hey guys I'm stuck on a JavaScript lesson: Access Multidimensional Arrays With Indexes. I've tried doing some research and I'm still so confused. If anyone can help I would be so so so happy
Joseph
@revisualize
Jan 11 2017 04:25
@Jimbobmahooley You don't need any more loops.
@Jimbobmahooley Yes. you can use if statements inside of a for loop.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:25
@cdunn0529 arr[0] accesses the first element of the array, arr[0][0] accesses the first element of the first subarray in the main array @cdunn0529
Joseph
@revisualize
Jan 11 2017 04:25
@Jimbobmahooley Look, you just need to CHANGE where / when you return no contact.
@Jimbobmahooley Did you not get that out of the commentary that I put together?
James Shore
@Jimbobmahooley
Jan 11 2017 04:28
@revisualize Let me try what I think you mean but I thought I had said I need to move the else statement that returns no contact
Ptolemy
@Ptolemy1
Jan 11 2017 04:28
Hey guys im having a problem with this?
Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:29
//say you have an array
arr = [[1,2], [2,3], [3,4]]
// this array is made up of 3 sub arrays, to access the first sub array we would do arr[0], so....
arr[0] = [1,2]:
// so if you wanted to access the 1 of this sub array you would use arr[0][0], so...
arr[0][0] = 1;
@cdunn0529
Joseph
@revisualize
Jan 11 2017 04:30
@Ptolemy1 What is the value of num ... var num = 4 + 3;
RomingArt
@RomingArt
Jan 11 2017 04:30
1 != true //false
0! = false // false shouldn't this be the answer true?
Joseph
@revisualize
Jan 11 2017 04:31
@HeebieGeeBee I have a document about that.
Ptolemy
@Ptolemy1
Jan 11 2017 04:31
2? I'm probably wrong
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:31
then put it up for her
Ptolemy
@Ptolemy1
Jan 11 2017 04:31
@revisualize 2? I'm probably wrong
@Ptolemy1 How is 4 + 3 ... 2?
Caroline Dunn
@cdunn0529
Jan 11 2017 04:32
Thankyou both. This is really pissing me off ha
Ptolemy
@Ptolemy1
Jan 11 2017 04:32
Oh i was reading it 4 - (3 *3) =2
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:32
that still doesnt = 2
Joseph
@revisualize
Jan 11 2017 04:32
@Ptolemy1 I have no idea where you got that from!.
Let's try again.
@Ptolemy1 What is the value of num ... var num = 4 + 3;
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:34
i think ppl get flustered sometimes, maybe good to take a 5 minute break clear your mind a bit and come back a bit fresher
Joseph
@revisualize
Jan 11 2017 04:34
@HeebieGeeBee I know right. Adding two numbers together can be rough.
Caroline Dunn
@cdunn0529
Jan 11 2017 04:34
@revisualize @HeebieGeeBee thankyou both SO MUCH!
CamperBot
@camperbot
Jan 11 2017 04:34
cdunn0529 sends brownie points to @revisualize and @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 520 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
:star2: 2913 | @revisualize |http://www.freecodecamp.com/revisualize
Caroline Dunn
@cdunn0529
Jan 11 2017 04:34
I finally got it
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:34
cool
Joseph
@revisualize
Jan 11 2017 04:34
@cdunn0529 Did my document help? If not what can I improve?
James Shore
@Jimbobmahooley
Jan 11 2017 04:35
@revisualize I see what you mean after it has looped through and not found a match then it needs to return no such contact however I don't know how to add this in without ending the if statement and if i end the if statement how can I nest a second if statement inside the first
Caroline Dunn
@cdunn0529
Jan 11 2017 04:35
Both of you were really helpful. It was a joint effort honestly. Thanks again
Joseph
@revisualize
Jan 11 2017 04:35
@Jimbobmahooley You are not required to have an else to an if.
Caroline Dunn
@cdunn0529
Jan 11 2017 04:35
I'm actually bookmarking the page for future reference
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:35
not a problem
he has lots of gists @cdunn0529
that will be helpful
Bozhidar Stoyanov Kabzamalov
@BozhidarKabzamalov
Jan 11 2017 04:36
Hello everyone, would any of you be so kind to check my codepen and tell me if you get correct info about the weather in your city?
Caroline Dunn
@cdunn0529
Jan 11 2017 04:36
Yes! This is great!
Joseph
@revisualize
Jan 11 2017 04:36
@Jimbobmahooley You can just have an if statement. And that if statement can have nested ifs
Bozhidar Stoyanov Kabzamalov
@BozhidarKabzamalov
Jan 11 2017 04:36
Joseph
@revisualize
Jan 11 2017 04:36
@Jimbobmahooley else's and else if's are NOT required.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:36
and i was talking about @cdunn0529 @revisualize but yeah i guess even sums can be tough sometimes if their mind gets into a mess
Joseph
@revisualize
Jan 11 2017 04:37
@HeebieGeeBee I have a bunch of gists because I'm lazy. cc: @cdunn0529
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:37
for some ppl at least
James Shore
@Jimbobmahooley
Jan 11 2017 04:37
@revisualize But if I don't find Jane I need to say that do I just use another if instead of saying else then?
Joseph
@revisualize
Jan 11 2017 04:37
@Jimbobmahooley NO!

@Jimbobmahooley Side question to change a bit of your logic.
Let's say you were at a big business event and throughout the event you got handed 200 business cards. Now, I walk up to you at the end and ask you.. Do you have a Business Card for "Jane Smith"? Now you loop look through your stack of 200 business cards. When would you tell me that you didn't have a business card for Jane?

@revisualize after I've checked all the cards

@Jimbobmahooley So, you're saying that after you loop look through all of the contacts cards in your array of object stack. That you'd tell me you don't have one for the individual?

@Jimbobmahooley

  // code before a for loop.
for (..........) {
  // Code inside of a for loop.
}
  // code after a for loop.
@greedylan 2,1,]; ?
Caroline Dunn
@cdunn0529
Jan 11 2017 04:38
@revisualize lazy or smart?
Dylan Hsiao
@greedylan
Jan 11 2017 04:38
@revisualize damn......wait it still the same. "return illegal statement"
var arr = [5, 4, 3, 2, 1];
var num = 1;

for(var i=0; i<arr.length; i++){
  num *= arr[i];
}
return num;
Joseph
@revisualize
Jan 11 2017 04:38
@cdunn0529 lazy. 100%.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:38
lazy/drunk off rum
Joseph
@revisualize
Jan 11 2017 04:39
@cdunn0529 I like to be helpful, I really like helping people learn. But, I found that I was saying the same thing over and over and over and over and over. And damn it... I don't like typing the same crap over and over again.
Joe Escobedo
@joeEscob1023
Jan 11 2017 04:39
i dont understand the ++ operator
Joseph
@revisualize
Jan 11 2017 04:39
@cdunn0529 See.

@TacoJoe

var num = 5;
num = num + 1; // 6
num += 1; // 7
num++; // 8

See how the one for getting num from 7 to 8 doesn't use the assignment operator (=)?
The lesson is requesting that you recreate that process so that you know how to increment and decrement a number with short notation.

Caroline Dunn
@cdunn0529
Jan 11 2017 04:39
@revisualize well then you're resourceful. Good for you. I don't see a problem with that. It's appreciated
Joe Escobedo
@joeEscob1023
Jan 11 2017 04:39
oooh ok now i get it
Phillip
@psnider22
Jan 11 2017 04:40
could i get some help with the diff two arrays bonfire? this is what i have function diff(arr1, arr2) {
var holderArray = [ ];
for (var i=0;i<arr1.length;i++){
if(arr2.indexOf(arr1[i])===-1){
holderArray.push(arr1[i]);
}
}
for (var j=0;j<arr2.length;j++){
if(arr1.indexOf(arr2[j])===-1){
holderArray.push(arr2[j]);
}
}
return holderArray;
}
diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
CamperBot
@camperbot
Jan 11 2017 04:40
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Joseph
@revisualize
Jan 11 2017 04:40
@cdunn0529 See... I didn't want to type all of that over and over again. I'm lazy. I just copied and pasted that :shit:
Caroline Dunn
@cdunn0529
Jan 11 2017 04:40
I love copy and paste
and the poo emoji
Joseph
@revisualize
Jan 11 2017 04:40
@cdunn0529 And because I'm lazy. And I took the time to refactor my verbiage. @TacoJoe gets it now.
But, I kind of want taco's now.
But, the Pho that I ate tonight was pretty amazing.
Caroline Dunn
@cdunn0529
Jan 11 2017 04:41
I had some wicked good pho a few weeks ago.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:42
is there bad pho?
Joseph
@revisualize
Jan 11 2017 04:42
@cdunn0529 See the problem that I'm having right now is that I don't understand why @Jimbobmahooley isn't getting it. When I've copied and pasted that to a BUNCH of people and they've gotten it.
@HeebieGeeBee Yes.
@HeebieGeeBee It comes in a can.
Caroline Dunn
@cdunn0529
Jan 11 2017 04:43
yeah there is
Joseph
@revisualize
Jan 11 2017 04:43
It's gross.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:43
well never had pho from a can
Joseph
@revisualize
Jan 11 2017 04:43
Don't.
It is
gross
Caroline Dunn
@cdunn0529
Jan 11 2017 04:43
it comes those Chinese buffets that want to encompass every Asian culture with their buffet...beware of the sushi as well
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:43
any soup type thing is just something that never does well processed but so easy to get nice when fresh
Joseph
@revisualize
Jan 11 2017 04:43
Seriously, chicken noodle soup from a can would have been better.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:43
its a werid thing
Joseph
@revisualize
Jan 11 2017 04:44
Rice noodles don't store in a can very well.
They're gross.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:44
well to can something you need to pressure cook it at a high temp
its gonna wreck any pasta
noodle aswell
same difference
Dylan Hsiao
@greedylan
Jan 11 2017 04:45
T__T "return illegal statement" why T_T
var arr = [5, 4, 3, 2, 1];
var num = 1;

for(var i=0; i<arr.length; i++){
  num *= arr[i];
}
return num;
Joe Escobedo
@joeEscob1023
Jan 11 2017 04:45

ok i dont get how

var myVar = 87;

myVar++;

gets me 88?

Caroline Dunn
@cdunn0529
Jan 11 2017 04:45
now I'm hungry
Joe Escobedo
@joeEscob1023
Jan 11 2017 04:45
who what when where and HOW?!?!
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:45
lol me too
babajide odusola
@cesarecaravaggio
Jan 11 2017 04:45

this really confuses me.

var arr = [
  [1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
  for (var j=0; j < arr[i].length; j++) {
    console.log(arr[i][j]);
  }
}

what does i and j mean?

Joseph
@revisualize
Jan 11 2017 04:46
@HeebieGeeBee I don't own a pressure cooker. Should I order for one of those online after searching for a backpack and some ammunition?
@cesarecaravaggio They are variables.
babajide odusola
@cesarecaravaggio
Jan 11 2017 04:46
but theyre not even defined
Joseph
@revisualize
Jan 11 2017 04:46
@cesarecaravaggio Yes they are!
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:46
or if you just want make some nice stews from tough meats so they melt like butter in your mouth
Ken Haduch
@khaduch
Jan 11 2017 04:46
@cesarecaravaggio - you're defining them in your for loops...
Joseph
@revisualize
Jan 11 2017 04:47
@cesarecaravaggio for (var i=0; <--- RIGHT THERE!
babajide odusola
@cesarecaravaggio
Jan 11 2017 04:47
yeah thx i need to understand it better.
ok so theyre being initialized to 0 in the for loop?
Joseph
@revisualize
Jan 11 2017 04:47
@cesarecaravaggio yes.
Phillip
@psnider22
Jan 11 2017 04:48
function diff(arr1, arr2) {
var holderArray = [ ];
for (var i=0;i<arr1.length;i++){
if(arr2.indexOf(arr1[i])===-1){
holderArray.push(arr1[i]);
}
}
for (var j=0;j<arr2.length;j++){
if(arr1.indexOf(arr2[j])===-1){
holderArray.push(arr2[j]);
}
}
return holderArray;
}
diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
babajide odusola
@cesarecaravaggio
Jan 11 2017 04:49
  for (var j=0; j < arr[i].length; j++) {
    console.log(arr[i][j]);
gonna go read up on that.
Joseph
@revisualize
Jan 11 2017 04:50

@Jimbobmahooley

@Jimbobmahooley Side question to change a bit of your logic.
Let's say you were at a big business event and throughout the event you got handed 200 business cards. Now, I walk up to you at the end and ask you.. Do you have a Business Card for "Jane Smith"? Now you loop look through your stack of 200 business cards. When would you tell me that you didn't have a business card for Jane?

@revisualize after I've checked all the cards

@Jimbobmahooley So, you're saying that after you loop look through all of the contacts cards in your array of object stack. That you'd tell me you don't have one for the individual?

@Jimbobmahooley

  // code before a for loop.
for (..........) {
  // Code inside of a for loop.
}
  // code after a for loop.

Look this is your code:

function lookUpProfile(firstName, prop){
// Only change code below this line
 for (var i=0; i < contacts.length; i++) {
  if (contacts[i][1] == firstName) {
    if (contacts[i].hasOwnProperty(prop)) {
      return contacts[prop];
    }
    else {
      return "No such property";
    }
  } 
  else {
    return "No such contact";   // you just need to move this line outside of your for loop.
  }                             // because you have nothing in your else block. You just delete the else block.
 }
}
pete88
@peteakhurst
Jan 11 2017 04:50

any one able to help with my toggle for the C > F please ?

http://codepen.io/pakhurst/pen/KaVZrL?editors=1010

HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:52
@peteakhurst you could set up some type of toggle class button
Joseph
@revisualize
Jan 11 2017 04:53
@cesarecaravaggio If only someone did a whole write up to help people understand nested for loops better.
Gist by revisualize / FreeCodeCamp - Nesting For Loops.js
...
That would be cool.
But, I mean. Why would someone do that?
pete88
@peteakhurst
Jan 11 2017 04:53
thank you
@HeebieGeeBee thank in advance jsut didnt call an id fixed it now
CamperBot
@camperbot
Jan 11 2017 04:53
peteakhurst sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 521 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
James Shore
@Jimbobmahooley
Jan 11 2017 04:53
@revisualize Are you saying that once it has looped through it all and there is no match then you don't need an else because clearly there is no else so you can just return no contact
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:53
if you press the button it would hide the c temp div, and show the f temp div, and vice versa
Joseph
@revisualize
Jan 11 2017 04:54
@Jimbobmahooley Yes.
James Shore
@Jimbobmahooley
Jan 11 2017 04:54
@revisualize Please don't print the whole conversation again just refer me
if I'm wrong
Joseph
@revisualize
Jan 11 2017 04:54
@Jimbobmahooley try it.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:54
im gonna redo my weather app sometime too
really want to do that time dependant background
wonder if theres anyway to make a background thats actually a time lapsed video but it doesnt run you just grab a particular frame from the video
depending on what time it is
DavidMinAZ
@DavidMinAZ
Jan 11 2017 04:57
Anyone know if using onclick in HTML is frowned upon?
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 04:58
frowned upon how?
Joseph
@revisualize
Jan 11 2017 04:59
Yes it is frowned upon. You shouldn't click on anything.
WHAT!?
@DavidMinAZ How are you supposed to make interactions or change data upon user clicks if you don't use .onClick()?
James Shore
@Jimbobmahooley
Jan 11 2017 05:01
@revisualize I understand that I just need to write
return "No such contact"
and I think you were saying it needs to be after the for loop to stop it halting and so that it has checked the whole object is that right?
Joseph
@revisualize
Jan 11 2017 05:02
@Jimbobmahooley Show me your code.
Sorry, I'm busy watching youtube. LOL.
https://www.youtube.com/watch?v=wBxblzxIXK4
James Shore
@Jimbobmahooley
Jan 11 2017 05:02
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i < contacts.length; i++) {
  if (contacts[i][1] == firstName) {
    if (contacts[i].hasOwnProperty(prop)) {
      return contacts[prop];
    }
  }

}
return "No such contact";

// Only change code above this line
}
Joseph
@revisualize
Jan 11 2017 05:03
@Jimbobmahooley Does that work?
ACK!
/collapse-all
James Shore
@Jimbobmahooley
Jan 11 2017 05:03
?
Ogundele Olumide
@Lumexralph
Jan 11 2017 05:04
hey everybody!
Markus Kiili
@Masd925
Jan 11 2017 05:04
@Lumexralph Hi.
Joseph
@revisualize
Jan 11 2017 05:04
@Jimbobmahooley what is this: contacts[i][1]
@Jimbobmahooley That isn't correct.
Did you have that in there before?!
Crap you did.
James Shore
@Jimbobmahooley
Jan 11 2017 05:05
Yeah I wasn't sure I was allowed to do that and yes i did
@revisualize
Joseph
@revisualize
Jan 11 2017 05:05
@Jimbobmahooley Let me get you another set of questions.
Ogundele Olumide
@Lumexralph
Jan 11 2017 05:05
@Jimbobmahooley if prop doesn't exist in contacts, you're to return No such property that and some other stuffs not right yet in your code
@Masd925 good morning
Joseph
@revisualize
Jan 11 2017 05:06
@Jimbobmahooley Where did you no such property go?
DavidMinAZ
@DavidMinAZ
Jan 11 2017 05:06
@revisualize @HeebieGeeBee :laughing: I should have explained that a bit better! I want a clickable DIV. Some say wrapping the whole DIV in an <a> is okay with HTML5... others says to use an onclick attribute in your HTML tag for the DIV... and of course you can target each DIV with jQuery and handle the click event with the .onClick() method. Which one is "most proper?"
Joseph
@revisualize
Jan 11 2017 05:06
@Jimbobmahooley Okay! Another set of questions.
We have an array of objects representing different people in our contacts lists.
Example: var contacts = [ { ... } , { ... } , { ... } , { ... } ];
James Shore
@Jimbobmahooley
Jan 11 2017 05:07
@revisualize okay
Joseph
@revisualize
Jan 11 2017 05:07

@Jimbobmahooley Let's say you have an object.

var myFriend = {
        "firstName": "Happy",
        "lastName": "Feet",
        "number": "-i",
        "likes": ["rhythm", "dancing", "soul"]
    }

How do you access the "firstName" of myFriend?

DavidMinAZ
@DavidMinAZ
Jan 11 2017 05:07
@revisualize @HeebieGeeBee Bearing in mind that I'm targeting dynamically built DIVs that I took my numbering logic out of thinking I wasn't going to need it, therefore they have no unique IDs now ;)
James Shore
@Jimbobmahooley
Jan 11 2017 05:07
@revisualize how do I access full screen the code or at least the whole image?
Joseph
@revisualize
Jan 11 2017 05:08
@Jimbobmahooley What?
Just look at the code and answer the question.
You're this far along it should be fairly easy for you.
@Jimbobmahooley I have the questions broken up. So, just one at a time.
Bojan Lazic
@kibs21k
Jan 11 2017 05:09
Maybe hes lacking focuse, take a break and get back to this :)
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 05:09
@DavidMinAZ i dont know whats more 'proper' to use in the industry, but i woulda thought whichever method works best for you is the one you should use no?
Joseph
@revisualize
Jan 11 2017 05:09
@kibs21k Well, I'm a jerkface. And I want to go to bed sometime soon.
Markus Kiili
@Masd925
Jan 11 2017 05:09
@DavidMinAZ Using onclick attribute is the old way of using event handlers in JS. It doesn't separate javascript from HTML.
James Shore
@Jimbobmahooley
Jan 11 2017 05:10
@revisualize myFriend[firstName]
Bojan Lazic
@kibs21k
Jan 11 2017 05:10
@Joseph you did a good job explaning
Joseph
@revisualize
Jan 11 2017 05:10
@Jimbobmahooley Incorrect. firstName isn't a variable.
pete88
@peteakhurst
Jan 11 2017 05:10

anyone able to figure out why my F isnt chaing to fixed(1) ?

http://codepen.io/pakhurst/pen/KaVZrL?editors=1010

if you click on the C it will change
James Shore
@Jimbobmahooley
Jan 11 2017 05:11
sorry I meant myFriend["firstName"] @revisualize
Joseph
@revisualize
Jan 11 2017 05:11
@Jimbobmahooley Great.
@Jimbobmahooley Let's say we have an array:
var contacts = [ "A" , "H" , "S" , "K" ];
How do you access "H"?
DavidMinAZ
@DavidMinAZ
Jan 11 2017 05:11
Thanks @revisualize @HeebieGeeBee @Masd925 for the feedback and assistance. Just trying to keep my code on the straight and narrow and not look too "hacky" for anyone who might peruse my projects
CamperBot
@camperbot
Jan 11 2017 05:11
davidminaz sends brownie points to @revisualize and @heebiegeebee and @masd925 :sparkles: :thumbsup: :sparkles:
:cookie: 522 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
:star2: 3155 | @masd925 |http://www.freecodecamp.com/masd925
:star2: 2914 | @revisualize |http://www.freecodecamp.com/revisualize
James Shore
@Jimbobmahooley
Jan 11 2017 05:12
@revisualize contacts1
Joseph
@revisualize
Jan 11 2017 05:12

@Jimbobmahooley Let's say we have an array of objects:

var contacts = [ { f: "A" } , { f: "H" } , { f: "S" } , { f: "K" } ];

How do you output "H"?

James Shore
@Jimbobmahooley
Jan 11 2017 05:12
that should be [1]
Joseph
@revisualize
Jan 11 2017 05:13
@Jimbobmahooley I know that. I know how Gitter messes up. Been doing this a while.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 05:13
@peteakhurst ((kTemp)*(9/5)-459.67).toFixed(1);
Joseph
@revisualize
Jan 11 2017 05:14
@Jimbobmahooley Do you see how the questions are building and building and building upon each other?
Bojan Lazic
@kibs21k
Jan 11 2017 05:14
Hey I’m unsure about this one how do you access it
James Shore
@Jimbobmahooley
Jan 11 2017 05:14
contacts1.f
Joseph
@revisualize
Jan 11 2017 05:14
@Jimbobmahooley There's a reason for that.
Bojan Lazic
@kibs21k
Jan 11 2017 05:14
contacts1.f ?
Joseph
@revisualize
Jan 11 2017 05:14
@Jimbobmahooley YAY!
@Jimbobmahooley What if f: was firstName: ?
Bojan Lazic
@kibs21k
Jan 11 2017 05:14
you can do contacts[1][f] ?
Joseph
@revisualize
Jan 11 2017 05:14
@kibs21k No you can't.
@kibs21k f isn't a variable.
Bojan Lazic
@kibs21k
Jan 11 2017 05:14
because it’s array ?
Joseph
@revisualize
Jan 11 2017 05:15
@kibs21k There is no f variable.
James Shore
@Jimbobmahooley
Jan 11 2017 05:15
@revisualize contacts[1]["f"]?
DavidMinAZ
@DavidMinAZ
Jan 11 2017 05:15
@kibs21k But you can, I believe, do contacts[1].f
Joseph
@revisualize
Jan 11 2017 05:15
@Jimbobmahooley That is also correct.
pete88
@peteakhurst
Jan 11 2017 05:15
@HeebieGeeBee gah now i got an error haha
Joseph
@revisualize
Jan 11 2017 05:15
@Jimbobmahooley What if f: was firstName: ?
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 05:16
what error?
Bojan Lazic
@kibs21k
Jan 11 2017 05:16
wait that isn’t multi array
Joseph
@revisualize
Jan 11 2017 05:16
@Jimbobmahooley Fix this line of code:
if (contacts[i][1] == firstName) {
@kibs21k No.
Bojan Lazic
@kibs21k
Jan 11 2017 05:16
it’s with {} as object right?
Joseph
@revisualize
Jan 11 2017 05:16
@kibs21k Yes.
Bojan Lazic
@kibs21k
Jan 11 2017 05:16
can’t you access object with [f] ?
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 05:17
@peteakhurst i dont see any errors
Joseph
@revisualize
Jan 11 2017 05:17
@Jimbobmahooley firstNm is not a variable.
@kibs21k NO!
James Shore
@Jimbobmahooley
Jan 11 2017 05:17
@revisualize accident
pete88
@peteakhurst
Jan 11 2017 05:17
@HeebieGeeBee was an extra ) after kTemp
Joseph
@revisualize
Jan 11 2017 05:17
@kibs21k there is no f variable.
Bojan Lazic
@kibs21k
Jan 11 2017 05:17
ahhh
I get it now
James Shore
@Jimbobmahooley
Jan 11 2017 05:17
@revisualize contacts[i]["firstName"]
Joseph
@revisualize
Jan 11 2017 05:17
@Jimbobmahooley Yes.
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 05:18
ok so its all sorted now @peteakhurst
Bojan Lazic
@kibs21k
Jan 11 2017 05:18
But it’s writen like a variable no ?
gupgdown
@r1nc3w1nd
Jan 11 2017 05:18
function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  var stringtoArray = str.split(" ");
  var lastWordArray = stringtoArray.push();
  return lastWordArray;
}

confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification");
Bojan Lazic
@kibs21k
Jan 11 2017 05:18
I mean it’s not declared here
Joseph
@revisualize
Jan 11 2017 05:18
@Jimbobmahooley You're still missing your nested if's else statement for "no such property"
gupgdown
@r1nc3w1nd
Jan 11 2017 05:18
this is returning a value of 15.
Markus Kiili
@Masd925
Jan 11 2017 05:18
@kibs21k 1 is not a valid variable name so it is taken as a number. f is a valid variable name so with [f] JS engine sees a variable f there.
Joseph
@revisualize
Jan 11 2017 05:18
This message was deleted
gupgdown
@r1nc3w1nd
Jan 11 2017 05:18
this a bug, or i dont understand my code? running it in my own interpreter returns proper values
Joseph
@revisualize
Jan 11 2017 05:19
@r1nc3w1nd You don't understand what you're doing.
@r1nc3w1nd Because you're not actually pushing anything.
@r1nc3w1nd That code better not work on your computer.
@r1nc3w1nd If it does... Your computer is BROKEN.
TECH SUPPORT!
gupgdown
@r1nc3w1nd
Jan 11 2017 05:21
youre right. push is no good.
meant to use pop
works now
@revisualize 'preeeeeeesh.
Joseph
@revisualize
Jan 11 2017 05:22
@r1nc3w1nd Doesn't complete all of the challenge requirements.
gupgdown
@r1nc3w1nd
Jan 11 2017 05:22
no, just what i was trying to accomplish for the time being
Joseph
@revisualize
Jan 11 2017 05:22
Okay.
James Shore
@Jimbobmahooley
Jan 11 2017 05:23
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i < contacts.length; i++) {
  if (contacts[i].firstName == firstName) {
    if (contacts[i].hasOwnProperty(prop)) {
      return contacts[prop];
    }
    else {
      return "No such property";
    }
  }

}
return "No such contact";
@revisualize ?
Joseph
@revisualize
Jan 11 2017 05:24
@Jimbobmahooley Does that finally work?
Bojan Lazic
@kibs21k
Jan 11 2017 05:24
var f;
var contacts = [ { f: "A" } , { f: "H" } , { f: "S" } , { f: "K" } ];
can you now access like contacts[1].[f] ?
James Shore
@Jimbobmahooley
Jan 11 2017 05:24
No.
Markus Kiili
@Masd925
Jan 11 2017 05:24
@Jimbobmahooley One [i] missing.
Bojan Lazic
@kibs21k
Jan 11 2017 05:24
I’m really confused about this one
Sakitha
@Sakitha
Jan 11 2017 05:24

can anyone help?

var ar=[1,2,3,4,5],sum=0;

forEach(ar,function(current){
  sum=sum+current;
})

function load() {
    alert(sum);
}

ReferenceError: forEach is not defined

Joseph
@revisualize
Jan 11 2017 05:24
@Jimbobmahooley return contacts[prop]; <--- your issue.
@kibs21k That doesn't work.
Winter S. Ndolo
@xulenvirp
Jan 11 2017 05:25
Goodmorning guys
Joseph
@revisualize
Jan 11 2017 05:25
@kibs21k You'd be doing a lookup of undefined
Bojan Lazic
@kibs21k
Jan 11 2017 05:25
ahh yeah
but if it had any value
Markus Kiili
@Masd925
Jan 11 2017 05:25
@kibs21k ["f"] would look for property key "f".
Bojan Lazic
@kibs21k
Jan 11 2017 05:25
would it work?
Joseph
@revisualize
Jan 11 2017 05:25
No.
@kibs21k contacts[1].[f] You'd have to define f with a value. And you'd have to remove the . in there.
Then it would work.
James Shore
@Jimbobmahooley
Jan 11 2017 05:26
@Masd925 @revisualize
return contacts[i][prop] ?
Joseph
@revisualize
Jan 11 2017 05:26
@Jimbobmahooley try it.
Bojan Lazic
@kibs21k
Jan 11 2017 05:26
ahh yeah
I didn’t see I mixed . with []
Joseph
@revisualize
Jan 11 2017 05:27
@Jimbobmahooley Does your challenge now solve?
@Jimbobmahooley Do you understand everything?
@Jimbobmahooley Is your brain an :egg: yet?
James Shore
@Jimbobmahooley
Jan 11 2017 05:27
@revisualize It works!!!! finally !!! I know its taken a while but thanks a lot
CamperBot
@camperbot
Jan 11 2017 05:27
jimbobmahooley sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2915 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 11 2017 05:27
@Jimbobmahooley Ready to bash my face in?
@Jimbobmahooley Do you have any questions?
@Jimbobmahooley How much do you :heartpulse: that lesson?
@Jimbobmahooley Do you realize that the lessons only get harder?
@Jimbobmahooley This :ship: is fun right?
Bojan Lazic
@kibs21k
Jan 11 2017 05:28
one more question if its undefined can I still do contacts1.f ? or contacts[1][f] ?
Reggie
@Reggie01
Jan 11 2017 05:28
@Sakitha you are calling forEach wrong. forEach docs.
ar.forEach( doSomething ) ;
James Shore
@Jimbobmahooley
Jan 11 2017 05:28
@revisualize well its 5:30 here so I need sleep soon but I just need to think about some things with the firstName but I will ask if I have any Q's yeah the lesson was good thanks
CamperBot
@camperbot
Jan 11 2017 05:28
jimbobmahooley sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: jimbobmahooley already gave revisualize points
Joseph
@revisualize
Jan 11 2017 05:29
@kibs21k Dot Notation is converting the value to a string (string literal). Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. Example: var num = 42; myObj[num];
Bojan Lazic
@kibs21k
Jan 11 2017 05:29
ahh yeah
thanks @revisualize
CamperBot
@camperbot
Jan 11 2017 05:29
kibs21k sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2916 | @revisualize |http://www.freecodecamp.com/revisualize
Sakitha
@Sakitha
Jan 11 2017 05:29
@Reggie01 thank you,i forgot that.
CamperBot
@camperbot
Jan 11 2017 05:29
sakitha sends brownie points to @reggie01 :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Jan 11 2017 05:29
Didn't I copy and paste that to you a long time ago?
Bojan Lazic
@kibs21k
Jan 11 2017 05:29
Sorry for the hasel felling a bit tierd
Joseph
@revisualize
Jan 11 2017 05:29
And you asked me if I was a bot?
Bojan Lazic
@kibs21k
Jan 11 2017 05:30
yeah :D
But I got confused with this and wanted to make it clear
Joseph
@revisualize
Jan 11 2017 05:30
I'm going back to my youtube video.
CamperBot
@camperbot
Jan 11 2017 05:30
api offline
Joseph
@revisualize
Jan 11 2017 05:30
NO!
NO!
Ayush Bahuguna
@relentless-coder
Jan 11 2017 05:30
I have a situation, I have an app that has bower components in which reside my angular files, I have uploaded it to my server, but I am getting error 404 on my angular files
Mike Spurlock
@Spurweezy
Jan 11 2017 05:31
ok what am I doing wrong here? I'm trying to apply escapse sequences in strings and I keep missing the first objectice "FirstLine\n\SecondLine\\rThirdline"
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 05:32
put up all your code and put it between backtciks @Spurweezy
backticks*
Joseph
@revisualize
Jan 11 2017 05:32
botstatus
CamperBot
@camperbot
Jan 11 2017 05:32
All bot systems are go!
botVersion: 0.0.12
env: prod
botname: camperbot
Joseph
@revisualize
Jan 11 2017 05:32
thanks @camperbot
CamperBot
@camperbot
Jan 11 2017 05:32
revisualize sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star2: 2866 | @camperbot |http://www.freecodecamp.com/camperbot
Joseph
@revisualize
Jan 11 2017 05:32
YAY!
about @revisualize
CamperBot
@camperbot
Jan 11 2017 05:33
:star2: 2916 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 11 2017 05:33
I PASSED @camperbot !!!
:muscle:
In your face you bot of code!
Ogundele Olumide
@Lumexralph
Jan 11 2017 05:33
@Spurweezy have you escaped backslash? before and after SecondLine?
James Shore
@Jimbobmahooley
Jan 11 2017 05:33
@revisualize earlier you told the guy that contacts[1][f] is wrong is that because its part of an array?
Mike Spurlock
@Spurweezy
Jan 11 2017 05:33
var myStr= "FirstLine\n\\SecondLine\\\rThirdline"; // Change this line
like this @HeebieGeeBee ?
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 05:34
yes ty
Joseph
@revisualize
Jan 11 2017 05:34
@Spurweezy Thirdline is not the same as ThirdLine
HeebieGeeBee
@HeebieGeeBee
Jan 11 2017 05:34
ThirdLine*
yeah that
Ogundele Olumide
@Lumexralph
Jan 11 2017 05:34
@Spurweezy i don't know if it's a typo, should it be Thirdline or ThirdLine?
Mike Spurlock
@Spurweezy
Jan 11 2017 05:35
wow still getting used to the thoroughness of coding, but thanks yall
thanks @HeebieGeeBee
CamperBot
@camperbot
Jan 11 2017 05:36
spurweezy sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
James Shore
@Jimbobmahooley
Jan 11 2017 05:36
@revisualize or do you just always have to put things in quotes when using bracket notation regardless of whether the property is already in brackets?
CamperBot
@camperbot
Jan 11 2017 05:36
:cookie: 523 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Mike Spurlock
@Spurweezy
Jan 11 2017 05:36
thanks @Lumexralph
CamperBot
@camperbot
Jan 11 2017 05:36
spurweezy sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 709 | @lumexralph |http://www.freecodecamp.com/lumexralph
Joseph
@revisualize
Jan 11 2017 05:36
@Jimbobmahooley Dot Notation is converting the value to a string (string literal). Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. Example: var num = 42; myObj[num];
Mike Spurlock
@Spurweezy
Jan 11 2017 05:36
thanks @revisualize
CamperBot
@camperbot
Jan 11 2017 05:36
spurweezy sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2917 | @revisualize |http://www.freecodecamp.com/revisualize
James Shore
@Jimbobmahooley
Jan 11 2017 05:39
@revisualize okay but say we had this inside an object
shoe: 9
and this inside a different object
"shoe": 9
do you still do ["shoe"] for both?
Dat Tran
@dattran91
Jan 11 2017 05:39
var myStr = "This is the start." + "This is the end.";
Can someone please help me with this?
Ogundele Olumide
@Lumexralph
Jan 11 2017 05:40
@dattran91 what're you trying to do?
Joseph
@revisualize
Jan 11 2017 05:40
@Jimbobmahooley You can use .shoe or ["shoe"]
James Shore
@Jimbobmahooley
Jan 11 2017 05:41
@revisualize okay so whether the property is
shoe
or
"shoe"
is irrelevant