These are chat archives for FreeCodeCamp/HelpJavaScript

15th
Apr 2017
Stephen James
@sjames1958gm
Apr 15 2017 00:03
@awb715 :+1:
David Amanze
@GodKingShogun
Apr 15 2017 00:06
@sjames1958gm i built upon the code you helped me with yesterday. i tried tracking it this way but it did not work. can you tell me why

function playSequence(sequence, index, counter) {
  if (index < counter) {
    setTimeout(function(){
        play(colors[sequence[index]]);
        index++;
  copyPlay=copyPlay.concat(sequence[index]);
  playSequence(sequence, index, counter);
      }, 2000);
  }  
  if (index===counter && index<sequence.length && !nextSequence) {
    function checkSequence(){
  setTimeout(function(){
  for (var j=0; j<playBack.length; j++){
    if (playBack[j]===copyPlay[j]){
    } else {
      checkPlay++;
    }
    }
    if (checkPlay===0) {
      nextSequence=true;
    } else {
    playBack=[];
    checkSequence();
    }
    },5000);
  }
  }
   if (nextSequence===true) {
    setTimeout(function(){
     nextSequence=false;
     playBack=[];
       index=0;
       counter++;
$("#display").html(counter);
     playSequence(sequence, index, counter);
      }, 2000);
  }
};
David Amanze
@GodKingShogun
Apr 15 2017 00:17
is everybody out partying just because it is Friday :satisfied:
bstahler123
@bstahler123
Apr 15 2017 00:21

var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUpProfile(firstName, prop){
// Only change code below this line

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
help plz

i am supposed to make the function take in to args and return a val from each object depending on the prop passed in
so akira likes should return the likes array
Keon Samuel
@keonsam
Apr 15 2017 00:23
We can't give you the answer only can help with the code.
bstahler123
@bstahler123
Apr 15 2017 00:23
ok
so i made a for loop
Keon Samuel
@keonsam
Apr 15 2017 00:23
yes
bstahler123
@bstahler123
Apr 15 2017 00:23
to go through the obejcts
Keon Samuel
@keonsam
Apr 15 2017 00:23
yes
bstahler123
@bstahler123
Apr 15 2017 00:24
i can get the first names to print out
Keon Samuel
@keonsam
Apr 15 2017 00:24
yes
bstahler123
@bstahler123
Apr 15 2017 00:24
but i dont know how to get
the values to print out
or the props
Keon Samuel
@keonsam
Apr 15 2017 00:24
use the keys
bstahler123
@bstahler123
Apr 15 2017 00:24
well
it wants
to be able to use multiply keys
like i can make a case switch function but i dont think thats what they want
Keon Samuel
@keonsam
Apr 15 2017 00:25
nope
you know what an object key is right?
bstahler123
@bstahler123
Apr 15 2017 00:26
yes
firstName
lastName
ect.
Keon Samuel
@keonsam
Apr 15 2017 00:26
good
bstahler123
@bstahler123
Apr 15 2017 00:29
so how would i check to see if a firstName exist in an array
i mean like with the loop
Keon Samuel
@keonsam
Apr 15 2017 00:29
exactly check if.
FlashHero
@FlashHero
Apr 15 2017 00:30
@bstahler123 use a hasOwnProperty method
bstahler123
@bstahler123
Apr 15 2017 00:31
ok would i have that in the look
loop*
FlashHero
@FlashHero
Apr 15 2017 00:31
show me your code
bstahler123
@bstahler123
Apr 15 2017 00:32
i dont have any yet im pseudo coding
I was thinking to make a for loop
to start
and go through the array of objects
FlashHero
@FlashHero
Apr 15 2017 00:32
ok
what's the challenge called
bstahler123
@bstahler123
Apr 15 2017 00:33
profile lookup
215 i beleive
Keon Samuel
@keonsam
Apr 15 2017 00:35
geez another maths question
bstahler123
@bstahler123
Apr 15 2017 00:37
@FlashHero so what are your thoughts?
FlashHero
@FlashHero
Apr 15 2017 00:38
@bstahler123 ok so you can make a loop that goes through the contacts and if contacts[i].firstName equals the firstName that you're passing in as argument and you also have to use the hasOwnProperty to see if that object has a property that equals to the property that you pass in as parameter
bstahler123
@bstahler123
Apr 15 2017 00:38
Ok thanks!
FlashHero
@FlashHero
Apr 15 2017 00:39
ok good luck
bstahler123
@bstahler123
Apr 15 2017 00:39
@FlashHero Thanks
CamperBot
@camperbot
Apr 15 2017 00:39
bstahler123 sends brownie points to @flashhero :sparkles: :thumbsup: :sparkles:
:cookie: 170 | @flashhero |http://www.freecodecamp.com/flashhero
Keon Samuel
@keonsam
Apr 15 2017 00:39
@FlashHero best to let people figure out these easy challenges.
Anavel
@arivera165
Apr 15 2017 00:42
I don't understand whats wrong with my code
everything else checks out

function testGreaterThan(val) {
if (val >= 101) { // Change this line
return "Over 100";
}

if (val >= 11) { // Change this line
return "Over 10";
}

return "10 or Under";
}

// Change this value to test
testGreaterThan(10);

FlashHero
@FlashHero
Apr 15 2017 00:42
@keonsam I didn't give out the answers
Anavel
@arivera165
Apr 15 2017 00:42
but it's saying that i should use the > operator at least twice
which i have
and it's still not letting me pass
Keon Samuel
@keonsam
Apr 15 2017 00:43
only use < and >
no equal
bstahler123
@bstahler123
Apr 15 2017 00:43
@keonsam there is a help button for a reason. He didn't give me the answer.
Anavel
@arivera165
Apr 15 2017 00:43
if i don't use the equal two of the points to pass don't pass
Keon Samuel
@keonsam
Apr 15 2017 00:43
100 is over a 100
> 100 is over a 100
meaning 101 up
Anavel
@arivera165
Apr 15 2017 00:44
the answer is 101 not 100
i don’t know what else to do
i’ve tried all sorts of variations
Keon Samuel
@keonsam
Apr 15 2017 00:48
didn't that work?
Anavel
@arivera165
Apr 15 2017 00:48
i don’t know where i would put another >
no it didnt work the answer is 101
i’m trying to send a screenshot of my work
David Amanze
@GodKingShogun
Apr 15 2017 00:48
@arivera165 what are you working on
Anavel
@arivera165
Apr 15 2017 00:48
but it wont let me put it in here for some reason
Keon Samuel
@keonsam
Apr 15 2017 00:48
use backticks.
Anavel
@arivera165
Apr 15 2017 00:48
comparison with the greater than operator
David Amanze
@GodKingShogun
Apr 15 2017 00:49
@arivera165 post what you have so far
Anavel
@arivera165
Apr 15 2017 00:50

function testGreaterThan(val) {
if (val >= 101) { // Change this line
return "Over 100";
}

if (val >= 11) { // Change this line
return "Over 10";
}

return "10 or Under";
}

// Change this value to test
testGreaterThan(10);

what is backpacks?
backpacks *
omg
backticks
Keon Samuel
@keonsam
Apr 15 2017 00:50
```
David Amanze
@GodKingShogun
Apr 15 2017 00:50
@arivera165 backpacks are those things you wear to school :smile:
Jor
@joreyesl
Apr 15 2017 00:50
@arivera165 they want you to use the > not the >= operator.
Ex: I can check greater than 5 by val >= 6, but using > i can do instead val > 5
Anavel
@arivera165
Apr 15 2017 00:51
autocorrect is the devil
David Amanze
@GodKingShogun
Apr 15 2017 00:51
@arivera165 the devil is the devil :satisfied:
Anavel
@arivera165
Apr 15 2017 00:51
where am i supposed to use backticks?
Rich
@thechoppinghand
Apr 15 2017 00:51
hey awesome humans
Keon Samuel
@keonsam
Apr 15 2017 00:51
for this
Rich
@thechoppinghand
Apr 15 2017 00:51
can someone help me understand this section: Modify Array Data With Indexes
Jor
@joreyesl
Apr 15 2017 00:52
@arivera165 How to format
David Amanze
@GodKingShogun
Apr 15 2017 00:52
@thechoppinghand im minus 1000 awesome and calling me human is a stretch :satisfied:
Keon Samuel
@keonsam
Apr 15 2017 00:52
she don't want to listen to me
Rich
@thechoppinghand
Apr 15 2017 00:52
haha @GodKingShogun
so bascially i thought var ourArray = [3,2,1]; ourArray[0] =1 // how does this equal now 1,2,1?
David Amanze
@GodKingShogun
Apr 15 2017 00:53
@keonsam probably because of your avatar :smile:
Keon Samuel
@keonsam
Apr 15 2017 00:53
you the one to talk.
Anavel
@arivera165
Apr 15 2017 00:54

`
function testGreaterThan(val) {
if (val >= 101) { // Change this line
return "Over 100";
}

if (val >= 11) { // Change this line
return "Over 10";
}

return "10 or Under";
}

// Change this value to test
testGreaterThan(10);

David Amanze
@GodKingShogun
Apr 15 2017 00:54
@thechoppinghand ourArray[0]=3
Anavel
@arivera165
Apr 15 2017 00:54
i dont get whqat you’re talking about
if i dont put 101 it tests negative
code.tiff
Keon Samuel
@keonsam
Apr 15 2017 00:54
function testGreaterThan(val) {
if (val > 100) { // Change this line
return "Over 100";
}
if (val > 10) { // Change this line
return "Over 10";
}
return "10 or Under";
}
// Change this value to test
testGreaterThan(10);
Rich
@thechoppinghand
Apr 15 2017 00:55
ohhh @GodKingShogun oh right!! sorry had a stupid moment
Jor
@joreyesl
Apr 15 2017 00:55
@arivera165 val >= 101 is logically the same as val > 100
Anavel
@arivera165
Apr 15 2017 00:55
omg. if i just put the greater than sign and 100 it tests negative
Jor
@joreyesl
Apr 15 2017 00:56
did you fix the other case as well?
Anavel
@arivera165
Apr 15 2017 00:56
UGH ok got it
David Amanze
@GodKingShogun
Apr 15 2017 00:56
@arivera165 what do you mean it tests negative. everything being returned is a string
Anavel
@arivera165
Apr 15 2017 00:56
i’m just retarded thats all
Rich
@thechoppinghand
Apr 15 2017 00:56
what i meant was: how does this claim to equal 1,3,3 : var ourArray = [1,2,3];
ourArray[1] = 3; // ourArray now equals [1,3,3]. (this was the sample it gave)
Anavel
@arivera165
Apr 15 2017 00:57
thanks @GodKingShogun and @joreyesl
CamperBot
@camperbot
Apr 15 2017 00:57
arivera165 sends brownie points to @godkingshogun and @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 189 | @godkingshogun |http://www.freecodecamp.com/godkingshogun
:cookie: 778 | @joreyesl |http://www.freecodecamp.com/joreyesl
David Amanze
@GodKingShogun
Apr 15 2017 00:57
@arivera165 :+1:
Keon Samuel
@keonsam
Apr 15 2017 00:57
I give you the
code
wth
David Amanze
@GodKingShogun
Apr 15 2017 00:57
@keonsam its the avatar bro :satisfied:
Anavel
@arivera165
Apr 15 2017 00:58
and thanks @keonsam
CamperBot
@camperbot
Apr 15 2017 00:58
arivera165 sends brownie points to @keonsam :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @keonsam |http://www.freecodecamp.com/keonsam
Jor
@joreyesl
Apr 15 2017 00:58
lol
Anavel
@arivera165
Apr 15 2017 00:58
i thought you were reiterating back to me what i was sending
Keon Samuel
@keonsam
Apr 15 2017 00:58
I guess she don't like black guys.
Anavel
@arivera165
Apr 15 2017 00:58
wth?
what does that have to do with anything
Keon Samuel
@keonsam
Apr 15 2017 00:58
I am mix too.
Anavel
@arivera165
Apr 15 2017 00:58
and how the hell would i know whether you were black or not
Keon Samuel
@keonsam
Apr 15 2017 00:58
joke
Anavel
@arivera165
Apr 15 2017 00:58
i’m hispanic dawg i am not mixed
Rich
@thechoppinghand
Apr 15 2017 00:59
damnnnnn lol plot twist
David Amanze
@GodKingShogun
Apr 15 2017 00:59
issa joke :satisfied:
Keon Samuel
@keonsam
Apr 15 2017 00:59
I am hispanic too
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 00:59
keon making friends again i see
Anavel
@arivera165
Apr 15 2017 00:59
alright im gonna go cook this steak ttyl
Rich
@thechoppinghand
Apr 15 2017 00:59
me 3
David Amanze
@GodKingShogun
Apr 15 2017 01:00
@HeebieGeeBee hello senpai
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:00
@GodKingShogun yo
David Amanze
@GodKingShogun
Apr 15 2017 01:00
@HeebieGeeBee yo
yoyo. get it :satisfied:
@GodKingShogun jumps off a building now :satisfied:
Keon Samuel
@keonsam
Apr 15 2017 01:01
she can't trust anything a black guy says lol
Anavel
@arivera165
Apr 15 2017 01:01
i’m still sitting here quit talking shit
Keon Samuel
@keonsam
Apr 15 2017 01:02
too much bad experience.
joke
Anavel
@arivera165
Apr 15 2017 01:02
says the guy who doesnt know the actual black guy i’m sleeping with
keon, go to sleep
Keon Samuel
@keonsam
Apr 15 2017 01:03
hey I am the king of all black guys.
Anavel
@arivera165
Apr 15 2017 01:03
ok, black gold over here
David Amanze
@GodKingShogun
Apr 15 2017 01:03
@keonsam cool. how did you get that title
@keonsam did you fill out some paperwork :satisfied:
Anavel
@arivera165
Apr 15 2017 01:05
he forgets about kendrick lamar
David Amanze
@GodKingShogun
Apr 15 2017 01:05
@arivera165 fake. isn't your king your black boyfriend :satisfied:
Anavel
@arivera165
Apr 15 2017 01:05
este con la mierda
i dont have a boyfriend baby, i dont do boyfriends
David Amanze
@GodKingShogun
Apr 15 2017 01:06
@arivera165 and you his queen :satisfied:
@arivera165 earlier you said you were with a black guy
Anavel
@arivera165
Apr 15 2017 01:06
nobody called him my boyfriend
that was all you boo
barki mustapha
@barkinet
Apr 15 2017 01:07

// Setup
var myPlants = [
{
type: "flowers",
list: [
"rose",
"tulip",
"dandelion"
]
},
{
type: "trees",
list: [
"fir",
"pine",
"birch"
]
}
];

// Only change code below this line

myPlants[0].secondTree[1]; // "pine"

Help
Anavel
@arivera165
Apr 15 2017 01:07
back to work ya bunch of gossips
David Amanze
@GodKingShogun
Apr 15 2017 01:07
@arivera165 had to scroll up for that and you are right. so he is your side piece :satisfied:
Moisés Man
@moigithub
Apr 15 2017 01:07
@arivera165 @GodKingShogun @keonsam stop that crap..
Gulsvi
@gulsvi
Apr 15 2017 01:07
Thank you @moigithub
CamperBot
@camperbot
Apr 15 2017 01:07
skycoder01 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3094 | @moigithub |http://www.freecodecamp.com/moigithub
Anavel
@arivera165
Apr 15 2017 01:08
what fun you guys are
Keon Samuel
@keonsam
Apr 15 2017 01:08
@arivera165 if you need a king hit me up.
Conor Murphy
@cmurphy580
Apr 15 2017 01:08
Can anyone tell me what is wrong with my CACHE function?
function cache(func) {

  return function () {
    return func.apply(this, arguments); 
  }

}
Anavel
@arivera165
Apr 15 2017 01:08
byeeeeeee
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:08
@barkinet pine is in the second element and theres no key called secondTree
Synsational
@Synsational
Apr 15 2017 01:08

function myLocalScope() {
'use strict';
var loc = "myVar";

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

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(myVar);

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

I'm a little confused here.

HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:08
@cmurphy580 whats it for?
David Amanze
@GodKingShogun
Apr 15 2017 01:09
@SkyCoder01 what challenge are you on now
silver537
@silver537
Apr 15 2017 01:09
Well that was disturbing.
So disturbing i mivht report it.
Anavel
@arivera165
Apr 15 2017 01:09
you’re gonna be fine
Gulsvi
@gulsvi
Apr 15 2017 01:09
Same one I was on last time you asked me @GodKingShogun :p
David Amanze
@GodKingShogun
Apr 15 2017 01:09
@SkyCoder01 which one is that :smile:
silver537
@silver537
Apr 15 2017 01:09
Might*
Gulsvi
@gulsvi
Apr 15 2017 01:10
Exact Change
Conor Murphy
@cmurphy580
Apr 15 2017 01:10
@HeebieGeeBee its just a codewars problem. the instructions say its for when you api calls to store the information you are pulling.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:10
@Synsational you meant to declare a variable called myVar in mylocalscope
Keon Samuel
@keonsam
Apr 15 2017 01:10
@silver537 what was?
Synsational
@Synsational
Apr 15 2017 01:10
@HeebieGeeBee I thought i did, no?
David Amanze
@GodKingShogun
Apr 15 2017 01:10
@SkyCoder01 are you taking a break
Gulsvi
@gulsvi
Apr 15 2017 01:10
Yeah, learning node.js and doing codewars until the beta is done
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:10
@Synsational no you declared a variable called loc and gave the the value 'myVar'
Anavel
@arivera165
Apr 15 2017 01:11
what is code wars @SkyCoder01
Synsational
@Synsational
Apr 15 2017 01:11
@HeebieGeeBee ohhhh
David Amanze
@GodKingShogun
Apr 15 2017 01:11
@SkyCoder01 is there any benefit doing codewars over fcc
Gulsvi
@gulsvi
Apr 15 2017 01:11
@arivera165 It's a site with more javascript challenges: http://codewars.com
silver537
@silver537
Apr 15 2017 01:11
@GodKingShogun yep
Anavel
@arivera165
Apr 15 2017 01:11
theres another one called codingame
is it similar?
silver537
@silver537
Apr 15 2017 01:12
Hackreactor
Codefights
Gulsvi
@gulsvi
Apr 15 2017 01:12
@GodKingShogun More variety, lots more discussion around potential answers, good/bad practices (IMO)
silver537
@silver537
Apr 15 2017 01:12
Good sites.
Anavel
@arivera165
Apr 15 2017 01:12
jesus, how many sites are there?
silver537
@silver537
Apr 15 2017 01:12
Codefigjts are more 'interview' oriented. So it really makes you think.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:12
@arivera165 lots
Anavel
@arivera165
Apr 15 2017 01:12
i’m basically grazing by the javascript i need all the practice i can get
Gulsvi
@gulsvi
Apr 15 2017 01:13
I hadn't heard of those other ones, but it's starting to sound like code. 15 different libraries that all do more or less the same thing
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:13
we have the best community though, well, usually
silver537
@silver537
Apr 15 2017 01:13
Codefights is my favorite out of all. Even the easiest challenges are hard.
barki mustapha
@barkinet
Apr 15 2017 01:13
@HeebieGeeBee thank you I will try
CamperBot
@camperbot
Apr 15 2017 01:13
barkinet sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1316 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Anavel
@arivera165
Apr 15 2017 01:14
damn there really is no ceiling
now somebody teach me how to hack so i can be like mr robot
Gulsvi
@gulsvi
Apr 15 2017 01:14
cbot
CamperBot
@camperbot
Apr 15 2017 01:14
you called?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:14
@SkyCoder01 how you getting on with node?
silver537
@silver537
Apr 15 2017 01:15
Youre shit out of luck girl
Anavel
@arivera165
Apr 15 2017 01:15
lmao figures
Gulsvi
@gulsvi
Apr 15 2017 01:15
@HeebieGeeBee Having fun so far - just finished the first couple of tutorial workshops. Learnyounode and Javascripting
Keon Samuel
@keonsam
Apr 15 2017 01:15
I can teach you how to hack
David Amanze
@GodKingShogun
Apr 15 2017 01:15
i learning code so i can become the hokage some day :satisfied:
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:15
@SkyCoder01 learnyounode was highly annoying
barki mustapha
@barkinet
Apr 15 2017 01:16

Accessing Nested Arrays
As we have seen in earlier examples, objects can contain both nested objects and nested arrays. Similar to accessing nested objects, Array bracket notation can be chained to access nested arrays.

Here is an example of how to access a nested array:

var ourPets = [
{
animalType: "cat",
names: [
"Meowzer",
"Fluffy",
"Kit-Cat"
]
},
{
animalType: "dog",
names: [
"Spot",
"Bowser",
"Frankie"
]
}
];
ourPets[0].names[1]; // "Fluffy"
ourPets[1].names[0]; // "Spot"
Instructions
Retrieve the second tree from the variable myPlants using object dot and array bracket notation

HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:16
@arivera165 there are plenty of mr robot fans in here
silver537
@silver537
Apr 15 2017 01:16
Omg. @GodKingShogun that was very gay
Gulsvi
@gulsvi
Apr 15 2017 01:16
haha :) @HeebieGeeBee
Doing stream adventures this weekend - that's the plan at least
Logan Kuzyk
@logankuzyk
Apr 15 2017 01:16
hi i need help with the stand in line challenge
Gulsvi
@gulsvi
Apr 15 2017 01:16
my second monitor just died though...and I feel so unproductive now
Anavel
@arivera165
Apr 15 2017 01:16
what is stram adventures!
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:16
im just working on a project with firebase
Keon Samuel
@keonsam
Apr 15 2017 01:16
I can teach how to hack
Anavel
@arivera165
Apr 15 2017 01:16
i need a comprehensive list of sites lol
Anavel
@arivera165
Apr 15 2017 01:17
teach me how to hack keon and mayb i’ll let you be my black king
Logan Kuzyk
@logankuzyk
Apr 15 2017 01:17
Keon Samuel
@keonsam
Apr 15 2017 01:17
sure just come over.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:17
@logankuzyk you need to push item into the arr and return and shift from arr
Keon Samuel
@keonsam
Apr 15 2017 01:18
joke
silver537
@silver537
Apr 15 2017 01:18
(Sarcasm)
David Amanze
@GodKingShogun
Apr 15 2017 01:18
@keonsam @arivera165 get a chat room :satisfied:
Anavel
@arivera165
Apr 15 2017 01:18

haters

Logan Kuzyk
@logankuzyk
Apr 15 2017 01:19
ok thanks @HeebieGeeBee
CamperBot
@camperbot
Apr 15 2017 01:19
logankuzyk sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1317 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Logan Kuzyk
@logankuzyk
Apr 15 2017 01:19
ukk try that
ill try that
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:19
a star wars trailer makes international news, wtf
silver537
@silver537
Apr 15 2017 01:19
Stupid right?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:19
yup
silver537
@silver537
Apr 15 2017 01:19
Lets talk about star wars and completely forget about WW3
David Amanze
@GodKingShogun
Apr 15 2017 01:20
im learning code so i can become a jedi one day :satisfied:
Anavel
@arivera165
Apr 15 2017 01:20
what happened w starwars
David Amanze
@GodKingShogun
Apr 15 2017 01:20
@GodKingShogun jumps of a building now
Anavel
@arivera165
Apr 15 2017 01:20
that sounds better than talking about dookie turd
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:20
@arivera165 they released a trailer for the new film apperently
Anavel
@arivera165
Apr 15 2017 01:20
excuse me, donald trump
jesus already?
did they film five movies at once?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:21
no idea
Gulsvi
@gulsvi
Apr 15 2017 01:21
image.png
Anavel
@arivera165
Apr 15 2017 01:21
im into it
Gulsvi
@gulsvi
Apr 15 2017 01:21
The hand that Rey's gonna lose :p ^^
silver537
@silver537
Apr 15 2017 01:21
What's star wars? Sounds like a something worth shit.
David Amanze
@GodKingShogun
Apr 15 2017 01:21
@arivera165 its like the avengers and how they have a new one every year or so
Anavel
@arivera165
Apr 15 2017 01:21
although i wasnt into the last one that much
filler film w/e
ugh disney why must you ruin everything
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:22
i fell asleep through rogue one
Anavel
@arivera165
Apr 15 2017 01:22
it was exciting not expecting it and then being all kid giddy
now i know it’s coming and i low key dont care
silver537
@silver537
Apr 15 2017 01:22
Low key?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:22
still havent seen the rest of it
silver537
@silver537
Apr 15 2017 01:22
We got a statistic people!
David Amanze
@GodKingShogun
Apr 15 2017 01:23
i watched the return movie even though i had never seen the others
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:23
i never really got into star wars
David Amanze
@GodKingShogun
Apr 15 2017 01:23
probably not going through because my eyes cant adjust to anything that is not 1080 p
not going to *
Anavel
@arivera165
Apr 15 2017 01:24
homygod
Joseph
@revisualize
Apr 15 2017 01:24
Hi.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:24
@revisualize hi
silver537
@silver537
Apr 15 2017 01:24
@revisualize how was the event?
Anavel
@arivera165
Apr 15 2017 01:24
go watch them it’s worth the pop culture knowledge if you dont get anything else out of it lol
Joseph
@revisualize
Apr 15 2017 01:24
@silver537 Which?
David Amanze
@GodKingShogun
Apr 15 2017 01:24
@revisualize the man without a face :satisfied:
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:24
how was the 360 imaging?
Anavel
@arivera165
Apr 15 2017 01:24
omg so many websites, so little time
Joseph
@revisualize
Apr 15 2017 01:25
@HeebieGeeBee Fine.
silver537
@silver537
Apr 15 2017 01:25
The one you were talkin about the other day. Maybe like 3 days ago. Idk
Joseph
@revisualize
Apr 15 2017 01:25
@silver537 Depends which day. I went to 3 events this week.
silver537
@silver537
Apr 15 2017 01:25
Oh this guy.
Synsational
@Synsational
Apr 15 2017 01:25

Trying to override the value of outerWear with "Sweater"
What am I doing wrong?

var outerWear = "T-Shirt";

function myOutfit() {
// Only change code below this line
var outerWear = "Sweater";

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

myOutfit();

silver537
@silver537
Apr 15 2017 01:25
i wish i could go to events like that. :(
bstahler123
@bstahler123
Apr 15 2017 01:25
@HeebieGeeBee got stuck on another challenge if you dont mind helping again XD ?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:26
@Synsational dont declare it again in the local scope
@bstahler123 i can try
bstahler123
@bstahler123
Apr 15 2017 01:26

var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUpProfile(firstName, prop){

//for loop that loops through contacts array,
for (i = 0; i < contacts.length; i++){
// Checks if contacts first name equals first name passed in arg

if (contacts[i].firstName === firstName){

// checks if contact has property of arg prop passed in
(contacts[i].hasOwnProperty(prop));

 console.log(prop);

}

}

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");

Synsational
@Synsational
Apr 15 2017 01:26
@HeebieGeeBee what do you mean? Should the local variable be named different?
Joseph
@revisualize
Apr 15 2017 01:27

@bstahler123 So, you wrote this:

// checks if contact has property of arg prop passed in
(contacts[i].hasOwnProperty(prop));
 console.log(prop);
}

But, that doesn't do what the comment says it does.

HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:27
@Synsational when you use var again within the function it doesnt overide the variable made global it it
you just want to re assign the value of the global variable
silver537
@silver537
Apr 15 2017 01:28
@Synsational bad practice. Its better not to mutate a global variable within a local scope
Synsational
@Synsational
Apr 15 2017 01:28
@HeebieGeeBee nvm it was the capital "S" in sweater. It was supposed to be lower case. smh.
bstahler123
@bstahler123
Apr 15 2017 01:28
@revisualize why?
barki mustapha
@barkinet
Apr 15 2017 01:28

// Setup
var myPlants = [
{
type: "flowers",
list: [
"rose",
"tulip",
"dandelion"
]
},
{
type: "trees",
list: [
"fir",
"pine",
"birch"
]
}
];

myPlants[0].list[1]; // "trees"
myPlants[1].list[0]; // "pine"

Joseph
@revisualize
Apr 15 2017 01:28
@bstahler123 First off. That isn't an if
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:28
@silver537 why do you think that?
Corey Pennington
@JuiceyDuecy
Apr 15 2017 01:28
wake up, 10 hrs later people still not using markdown?
Keon Samuel
@keonsam
Apr 15 2017 01:29
anyone here know swift?
bstahler123
@bstahler123
Apr 15 2017 01:29
@revisualize i can't use that in an if statement?
Mohamed Derhalli
@derhallim
Apr 15 2017 01:29
:v:
Joseph
@revisualize
Apr 15 2017 01:29
@bstahler123 I guess you could.
Keon Samuel
@keonsam
Apr 15 2017 01:30
listen to the pro
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:30
pine is the second element in the list @barkinet
Mohamed Derhalli
@derhallim
Apr 15 2017 01:30
@keonsam i know swift
silver537
@silver537
Apr 15 2017 01:30
What
Corey Pennington
@JuiceyDuecy
Apr 15 2017 01:30
there's not a swift chat room? hmmm...
bstahler123
@bstahler123
Apr 15 2017 01:30
i thought that hasOwnProperty check the contacts[i] for that prop?
Joseph
@revisualize
Apr 15 2017 01:30
@bstahler123 Let's break this down.
(contacts[i].hasOwnProperty(prop)); ... this evaluates to true or false .. You should use .hasOwnProperty() in a function call or an if conditional.
Mohamed Derhalli
@derhallim
Apr 15 2017 01:30
what do u need from swift?
Keon Samuel
@keonsam
Apr 15 2017 01:30
if @revisualize says if(else(if)) do it.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:31
@silver537 you said you shouldnt update global variables within functions
why do you think you shouldnt?
Joseph
@revisualize
Apr 15 2017 01:31
@bstahler123 Does that make sense?
Corey Pennington
@JuiceyDuecy
Apr 15 2017 01:32
@HeebieGeeBee would it matter, as the local variable stays local within that function? and is not accessible outside of the function? Asking a question.
bstahler123
@bstahler123
Apr 15 2017 01:32
@revisualize so u need to take the contacts[i] that is equal to the arg and put it into its own function with the .hasOwnProperty?
Joseph
@revisualize
Apr 15 2017 01:32
@bstahler123 .hasOwnProperty() evaluates to a boolean value. (true / false)
bstahler123
@bstahler123
Apr 15 2017 01:32
ok
Joseph
@revisualize
Apr 15 2017 01:32
@bstahler123 No. That's not what I said.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:32
@JuiceyDuecy but thats not what he said
bstahler123
@bstahler123
Apr 15 2017 01:32
ok
Im listening
Joseph
@revisualize
Apr 15 2017 01:33
@bstahler123 If you want to use .hasOwnProperty() you can do a few things.
@bstahler123 You can assign .hasOwnProperty() to a variable.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:33
he said you should not update a global variable from with in a function
Joseph
@revisualize
Apr 15 2017 01:33
@bstahler123 You can use .hasOwnProperty() inside of an if condition
silver537
@silver537
Apr 15 2017 01:33
Cause it can cause bad side effects. And also functions are meant to return Values. So its better to pass in that global variable as an argument. And do whatever you want with the parameter variable.
Joseph
@revisualize
Apr 15 2017 01:33
@bstahler123 You can use .hasOwnProperty() as an argument for a function call.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:34
@silver537 where did you hear that
not all functions have to return values
Joseph
@revisualize
Apr 15 2017 01:34
@bstahler123 But, doing .hasOwnProperty() on it's own random line. Doesn't really do anything because. All you're returning back to the function caller a boolean value.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:34
updating global variables within functions is done all the time
Joseph
@revisualize
Apr 15 2017 01:35
@bstahler123 This line: (contacts[i].hasOwnProperty(prop)); all by itself. Doesn't really do anything.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:36
i dont see how oop would be possible without being able to
Joseph
@revisualize
Apr 15 2017 01:36
@bstahler123 That was a lot. Does it make sense?
bstahler123
@bstahler123
Apr 15 2017 01:36
@revisualize yes
but
Keon Samuel
@keonsam
Apr 15 2017 01:36
read the doc
bstahler123
@bstahler123
Apr 15 2017 01:36
i was thinking

for (i = 0; i < contacts.length; i++){
// Checks if contacts first name equals first name passed in arg

if (contacts[i].firstName === firstName){

// checks if contact has property of arg prop passed in
(contacts[i].hasOwnProperty(prop));

 console.log(prop);

}

}

Keon Samuel
@keonsam
Apr 15 2017 01:36
should clear things up
bstahler123
@bstahler123
Apr 15 2017 01:36
that inside the if statement
so if
Keon Samuel
@keonsam
Apr 15 2017 01:37
return
bstahler123
@bstahler123
Apr 15 2017 01:37
the firstName = the Firstname
then it would check
for the prop
Keon Samuel
@keonsam
Apr 15 2017 01:37
console.log won't work on any freeCodeCamp challenge
Joseph
@revisualize
Apr 15 2017 01:37
@bstahler123 But, that isn't how that line works.
bstahler123
@bstahler123
Apr 15 2017 01:37
i use the dev
google chrome dev tools
they do work
Keon Samuel
@keonsam
Apr 15 2017 01:37
return "string";
cool
Joseph
@revisualize
Apr 15 2017 01:38
@bstahler123 You need to change
(contacts[i].hasOwnProperty(prop));
to
if (contacts[i].hasOwnProperty(prop)) { ...stuff..in..here }
bstahler123
@bstahler123
Apr 15 2017 01:38
ahh
ok
Caleb Pearman
@capearman
Apr 15 2017 01:38
Hey campers, where do you place the product variable in the loop on Nesting For Loops Challenge?
silver537
@silver537
Apr 15 2017 01:39
@revisualize with the dots and everything?!?!
Joseph
@revisualize
Apr 15 2017 01:39
@capearman Depends. What do you with product?
Corey Pennington
@JuiceyDuecy
Apr 15 2017 01:39
off to work, happy coding!
Keon Samuel
@keonsam
Apr 15 2017 01:39
happy working
@JuiceyDuecy post your code.
Joseph
@revisualize
Apr 15 2017 01:40
@bstahler123 Is all of that starting to make sense?
Caleb Pearman
@capearman
Apr 15 2017 01:40
@revisualize you multiply it by each number in the sub-arrays of arr
Corey Pennington
@JuiceyDuecy
Apr 15 2017 01:40
@keonsam I will when I have some :(
spare code, anyone?
Keon Samuel
@keonsam
Apr 15 2017 01:41
not you, sorry.
@capearman
bstahler123
@bstahler123
Apr 15 2017 01:42
@revisualize it does make sense but I cant get this shit to work still LOL
I got it logging the arg
but not the value of the arg
silver537
@silver537
Apr 15 2017 01:42
Think
Joseph
@revisualize
Apr 15 2017 01:43
@bstahler123 Well, you're working on a challenge that is taking ALL of the previous knowledge and distilling into one problem.
bstahler123
@bstahler123
Apr 15 2017 01:43
and its still logging for all the objects in the loop
yeah
i have literally spent over an hour on this one
giving me a headache
lol
Keon Samuel
@keonsam
Apr 15 2017 01:43
lol
Keon Samuel
@keonsam
Apr 15 2017 01:44
post your code.
bstahler123
@bstahler123
Apr 15 2017 01:44
how do i post it in a snippet?
like so u can see it how i see it and not in plain text
Joseph
@revisualize
Apr 15 2017 01:44

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.

bstahler123
@bstahler123
Apr 15 2017 01:46

var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUpProfile(firstName, prop){

//for loop that loops through contacts array,
for (i = 0; i < contacts.length; i++){
// Checks if contacts first name equals first name passed in arg

if (contacts[i].firstName === firstName){

// checks if contact has property of arg prop passed in
if (contacts[i].hasOwnProperty(prop)){
console.log(prop[val]);

}

}

}

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");

Keon Samuel
@keonsam
Apr 15 2017 01:47
what are you doing man
bstahler123
@bstahler123
Apr 15 2017 01:47
...
what the guy before told me to do
not joesph but the other guy
silver537
@silver537
Apr 15 2017 01:47
@bstahler123 did you even read?
Nvm
bstahler123
@bstahler123
Apr 15 2017 01:48
LOL
read what?
the instructions?
yeah
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:48
@bstahler123 youre own right track
Joseph
@revisualize
Apr 15 2017 01:48

Gist by revisualize / FreeCodeCamp - Profile Lookup.js

We have an array of objects representing different people in our contacts lists.
Example: var contacts = [ { ... } , { ... } , { ... } , { ... } ];

HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:48
you just need to make your returns now
silver537
@silver537
Apr 15 2017 01:48
I said nvm! But shit you didnt even read that. -_-
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 01:49
on*
Keon Samuel
@keonsam
Apr 15 2017 01:49

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

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

Joseph
@revisualize
Apr 15 2017 01:51
@HeebieGeeBee You know.. I think.. I think it is that time.
bstahler123
@bstahler123
Apr 15 2017 01:51
well the loop doesn't stop it is logging the prop for all the objects
Keon Samuel
@keonsam
Apr 15 2017 01:52
for (i = 0; i < contacts.length; i++){
// Checks if contacts first name equals first name passed in arg
if (contacts[i].firstName === firstName){
// checks if contact has property of arg prop passed in
if (contacts[i].hasOwnProperty(prop)){
return contacts[prop];
else{
Joseph
@revisualize
Apr 15 2017 01:52
@bstahler123 But, you can make the loop stop looping.
Keon Samuel
@keonsam
Apr 15 2017 01:53
sorry return contacts[i][prop];
else {
revisualize @revisualize is afk. BRB. The Rum isn't gone yet.
Keon Samuel
@keonsam
Apr 15 2017 01:53
return "No such property";
David Amanze
@GodKingShogun
Apr 15 2017 01:53
if any one can tell me why my game is not working i will probably not kill myself
Keon Samuel
@keonsam
Apr 15 2017 01:54
lol
@bstahler123 correct the letter casing .
you have to close the if statement then return "No such contact";
@GodKingShogun how the hell man
that shotgun sound.
Joseph
@revisualize
Apr 15 2017 01:58
RUM!
silver537
@silver537
Apr 15 2017 01:58
Ew
MUR!
David Amanze
@GodKingShogun
Apr 15 2017 01:58
its my special move @keonsam
@keonsam if all else fails and i cant solve the code when the examiner goes to check it and they hear the shotgun sound they will close it immediately :satisfied:
Keon Samuel
@keonsam
Apr 15 2017 01:59
that come from out of no way and my speakers loud as hell.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:00
@revisualize rum time!!
Jor
@joreyesl
Apr 15 2017 02:00
image.png
@GodKingShogun i think its broken
Joseph
@revisualize
Apr 15 2017 02:01
@HeebieGeeBee It's 7pm now.
:D
RUM TIME!
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:01
@joreyesl its a unique style approach
David Amanze
@GodKingShogun
Apr 15 2017 02:01
@joreyesl i dont know why it looks like that on other screens but on my codepen it is alligned
Jor
@joreyesl
Apr 15 2017 02:01
@HeebieGeeBee ah I see :laughing:
David Amanze
@GodKingShogun
Apr 15 2017 02:01
@HeebieGeeBee or that too lol
Jor
@joreyesl
Apr 15 2017 02:02
@GodKingShogun makes it more challenging? lol
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:02
@revisualize enjoy , happy easter
Keon Samuel
@keonsam
Apr 15 2017 02:02
do you guys drink strong rum or baby rum?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:03
niether
Joseph
@revisualize
Apr 15 2017 02:03
@keonsam I drink Captain Morgen
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:05
north korea is funny, how do these soldiers get all their medals, when was the last time you heard about north korean soldiers being in a battle?
barki mustapha
@barkinet
Apr 15 2017 02:08
@HeebieGeeBee done
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:08
cool well done
barki mustapha
@barkinet
Apr 15 2017 02:09
myplants[1].list[1]
...
Thank u @HeebieGeeBee
CamperBot
@camperbot
Apr 15 2017 02:09
:warning: barkinet already gave heebiegeebee points
barkinet sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
bstahler123
@bstahler123
Apr 15 2017 02:12
@HeebieGeeBee @keonsam @revisualize Thanks for the help guys!
CamperBot
@camperbot
Apr 15 2017 02:12
bstahler123 sends brownie points to @heebiegeebee and @keonsam and @revisualize :sparkles: :thumbsup: :sparkles:
:cookie: 309 | @keonsam |http://www.freecodecamp.com/keonsam
:star2: 1318 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
:star2: 3746 | @revisualize |http://www.freecodecamp.com/revisualize
David Amanze
@GodKingShogun
Apr 15 2017 02:13
@HeebieGeeBee @revisualize @joreyesl so im hundred and one percent know the issue with my game. i have a sequence that plays on my dom and i save that info into an array. nod if you are following :smile:
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:13
am not following sorry
@GodKingShogun but feel free to think out loud
David Amanze
@GodKingShogun
Apr 15 2017 02:16
@HeebieGeeBee @keonsam @joreyesl the problem lies in my code waiting for the user to input that same sequence or any other seqyence which is stored in a different array. so once the user has input his sequence, my code creates a loop that loops through the user's array and compares it to the first array but i need my code to give my user a chance to input
how would i do that @HeebieGeeBee @keonsam @joreyesl
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:18
@GodKingShogun what about if after you play the sequence you wait the the user to click and compare what he clicks to the first element in the array
then the next time he clicks to the second element and so on
that way you'll know when he makes a mistake straight away
David Amanze
@GodKingShogun
Apr 15 2017 02:20
@HeebieGeeBee i could also go about that route but the meaty question here is how i would get my code to wait for the user to input something
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:21
@GodKingShogun what do you mean by wait?
what plays your sequence?
a setinterval?
David Amanze
@GodKingShogun
Apr 15 2017 02:22
  if (index===counter && index<sequence.length && nextSequence===false) {
 function checkSequence(){
 setTimeout(function(){   
   for (var j=0; j<playBack.length; j++){
    if (playBack[j]==copyPlay[j]){
    } else {
      checkPlay++;
    }
    }
 },3000);
 setTimeout(function(){
if (checkPlay===0) {
      nextSequence=true;
    } else {
    playBack=[];
playSequence(sequence,0,counter);
    }
    },5000);
  }
  }
@HeebieGeeBee this is what i currently have
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:23
@GodKingShogun seem like you need to clear the time out after you played the squence
David Amanze
@GodKingShogun
Apr 15 2017 02:24
@HeebieGeeBee this is when the sequence is done playing. the loop is checking to compare the users input which is playback and the sequence copyPlay
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:26
@GodKingShogun why do you have so many recursive calls in your play sequence function
Keon Samuel
@keonsam
Apr 15 2017 02:26
sleep time
Saboor Malik
@MathematicsCoding
Apr 15 2017 02:26
Hey can someone help me with weather API?
Keon Samuel
@keonsam
Apr 15 2017 02:27
what happen you need?
help
David Amanze
@GodKingShogun
Apr 15 2017 02:27
@HeebieGeeBee because every time it plays through one sequence it needs to play the same sequence plus 1 the next time it is called or if the user gets it wrong play the same sequence
Keon Samuel
@keonsam
Apr 15 2017 02:27
lol I need to sleep
Saboor Malik
@MathematicsCoding
Apr 15 2017 02:27
@keonsam lol its ok have a good sleep
David Amanze
@GodKingShogun
Apr 15 2017 02:28
@HeebieGeeBee what did you mean by clearTimeout and where would i clear it
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:28
@GodKingShogun i dont what youre doing it, but seems to you would have a squence generator function , a play sequence function and a user input function
you generate a sequence, then the sequence plays, then user inputs his sequence
and so on and so on
@GodKingShogun well usually if youre setting a timeout you'll want to clear it , at some time
David Amanze
@GodKingShogun
Apr 15 2017 02:30
@HeebieGeeBee thats what i current have. im confused on what you want me to do
Caleb Pearman
@capearman
Apr 15 2017 02:31
Hey campers, I'm on the Nesting For Loops Challenge, where do I place the product variable inside the loop?

function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i=0; i<arr.length; i++) {
    for (var j=0; j < arr[i].length; j++) {

    }
  }

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:31
@GodKingShogun dont want you to do anything
was just wondering and making suggestions
David Amanze
@GodKingShogun
Apr 15 2017 02:31
@HeebieGeeBee i didn't post all my code just the one i need help with which is the part where the user will get a chance to input something but i already have my sequence generator function set up and the play sequence set up already
Joseph
@revisualize
Apr 15 2017 02:31
@capearman Well.
@capearman Why are you making two for loops?
@capearman What do you want to access inside of your two for loops? Why are you drilling in so far?
Caleb Pearman
@capearman
Apr 15 2017 02:33
@revisualize they are nested. I thought that was the point of the exercise?
Joseph
@revisualize
Apr 15 2017 02:33
@capearman If you have an i for loop what does i represent?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:33
@GodKingShogun so no idea then i dont know how all your code is working
Joseph
@revisualize
Apr 15 2017 02:33
@capearman They are. it is.
Caleb Pearman
@capearman
Apr 15 2017 02:33
@revisualize it's the variable index
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:33
i dont get this whole having to wait
Joseph
@revisualize
Apr 15 2017 02:33
@capearman Index of what?
David Amanze
@GodKingShogun
Apr 15 2017 02:33
Caleb Pearman
@capearman
Apr 15 2017 02:33
@revisualize the first array
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:33
@GodKingShogun i cant go all through your code to figure it out
Joseph
@revisualize
Apr 15 2017 02:33
@capearman Great.
@capearman Now what does j represent?
Caleb Pearman
@capearman
Apr 15 2017 02:34
@revisualize the index of the second array
@revisualize the index of the sub array
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:34
how ever you sequence is being played just make it stop, then just evaluate what the user is inputing and then go from there
Joseph
@revisualize
Apr 15 2017 02:34
@capearman What does the index of the second array (actually it is "nested"/sub array) give you access to?
Caleb Pearman
@capearman
Apr 15 2017 02:35
@revisualize the index of the sub array
Joseph
@revisualize
Apr 15 2017 02:35
Was that an answer to my last question?
Berry
@bsemexan
Apr 15 2017 02:35
Is it ok to ask a question about the exact change challenge in here?
Caleb Pearman
@capearman
Apr 15 2017 02:36
@revisualize Yes
Joseph
@revisualize
Apr 15 2017 02:36
@capearman Re-read the question. I don't think your response answers it correctly.
@capearman I'm looking for a response that is more specific.
David Amanze
@GodKingShogun
Apr 15 2017 02:38
@HeebieGeeBee so the little snippet i posted earlier is when my dom is done playing the current sequence. when that sequence is finished playing the person playing has to be able to have a chance to click on buttons on the simon game before the sequence and and the users input are compared
Joseph
@revisualize
Apr 15 2017 02:39
@capearman If you get too stuck. I'll answer it for you.
Caleb Pearman
@capearman
Apr 15 2017 02:39
@revisualize the first number of the first array inside the array?
Fabusuyi David Oluwasegun
@dav4thevid
Apr 15 2017 02:39
hello world
var randomNumberBetween0and19 = Math.floor(Math.random() * 20);

function randomWholeNum() {

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

}
David Amanze
@GodKingShogun
Apr 15 2017 02:40
@HeebieGeeBee if they are the same the same sequence that just played plus one new one is played. if not the sequence is played again and the user gets another chance to input the correct sequence
Joseph
@revisualize
Apr 15 2017 02:40
@capearman Okay.
Fabusuyi David Oluwasegun
@dav4thevid
Apr 15 2017 02:40
pls why is my code not passing
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:40
@GodKingShogun right
so why all you doing all that with in the play sequence function
surely the function of the play sequence function is to just play the function
Ming Zhu
@chocobrownie
Apr 15 2017 02:41
'''
CamperBot
@camperbot
Apr 15 2017 02:41
:bulb: to format code use backticks! ``` more info
Joseph
@revisualize
Apr 15 2017 02:41
@capearman So. The first variable (i) declaration in the first for loop. Allows you to loop through all of the parent array elements that are arrays.
The second variable (j) declaration in the second for loop allows you to loop through all of the sub array elements that happen to be values. (In this case numbers).
Is this correct?
Ming Zhu
@chocobrownie
Apr 15 2017 02:42
System reported bug on my case syntax, I'm not sure what is wrong...

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);
Brian
@BrianCodes33
Apr 15 2017 02:42
im trying to change my nav color when i scroll down page. cant figure out
Joseph
@revisualize
Apr 15 2017 02:42
@chocobrownie You don't have a switch
@chocobrownie You just have a bunch of cases.
Caleb Pearman
@capearman
Apr 15 2017 02:42
@revisualize Yes this is correct
Joseph
@revisualize
Apr 15 2017 02:43
@capearman Well, what are you supposed to be multiplying product by?
(all of the values in the sub array)
Ming Zhu
@chocobrownie
Apr 15 2017 02:43
@revisualize Ohh thank you how can i not see that
CamperBot
@camperbot
Apr 15 2017 02:43
chocobrownie sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3747 | @revisualize |http://www.freecodecamp.com/revisualize
silver537
@silver537
Apr 15 2017 02:43
six hashes to make it small?
Caleb Pearman
@capearman
Apr 15 2017 02:43
@revisualize each number in the sub-arrays
Joseph
@revisualize
Apr 15 2017 02:44
@capearman OMG! How do you think you would do that?
@capearman (Do you see how I've shaped my questions to drive you to answer the question for yourself?)
David Amanze
@GodKingShogun
Apr 15 2017 02:45
@HeebieGeeBee it is just the name but it consists of three major if. the first if plays the sequence. the second if checks if the user has input in the correct sequence. the third if adds one to the sequence. and it keeps looping through these three ifs until the 20th sequence which is when the user wins. they build upon each other so the second if is called when the first if has passed and the third if is called when the second if has passed and the third if loops back to the first if. i call it THE TRIFECTA IF :smile:
Caleb Pearman
@capearman
Apr 15 2017 02:45
@revisualize multiply product by j? or replace j with product with j since product = 1 anyway?
I am seriously still struggling with this.
Joseph
@revisualize
Apr 15 2017 02:46
@capearman No.
@capearman Why did you create i?
David Amanze
@GodKingShogun
Apr 15 2017 02:46
@GodKingShogun THE TRIFECTA THREE
@HeebieGeeBee
Joseph
@revisualize
Apr 15 2017 02:46
@capearman Let's try a different question.
Berry
@bsemexan
Apr 15 2017 02:47
I am just curious what additional tests might be of value other than the tests written for exactChange problem
https://www.freecodecamp.com/challenges/exact-change
Joseph
@revisualize
Apr 15 2017 02:47
@capearman var arr = [["a1"], ["b2","c2"], ["d3","e3","f3"], ["g4","h4","i4","k4"]];
What does arr[2] give you?
Caleb Pearman
@capearman
Apr 15 2017 02:49
@revisualize arr[2] gives me ["g4","h4","i4","k4"]
Joseph
@revisualize
Apr 15 2017 02:49
@capearman Incorrect.
Caleb Pearman
@capearman
Apr 15 2017 02:50
@revisualize I mean ["b2","c2"]
Joseph
@revisualize
Apr 15 2017 02:50
That's arr[3]
Joseph
@revisualize
Apr 15 2017 02:50
@capearman That's arr[1]
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:50
that is my thinking it shouldnt be that compicated
@GodKingShogun i dont get all this recursive call and stuff
Joseph
@revisualize
Apr 15 2017 02:51
@capearman Let me answer it for you.
Caleb Pearman
@capearman
Apr 15 2017 02:51
@revisualize okay...
rlgerman25
@rlgerman25
Apr 15 2017 02:52
Hey guys! I am stuck in the "Convert Celsius to Fahrenheit" challenge:
I did not change any of the code in the challenge, I just added my code, as commanded. Code bellow:
fahrenheit *= 9/5 + 32;
Caleb Pearman
@capearman
Apr 15 2017 02:52
@revisualize wait!
Joseph
@revisualize
Apr 15 2017 02:52
@capearman
var arr = [["a1"], ["b2","c2"], ["d3","e3","f3"], ["g4","h4","i4","k4"]];
arr[0] is ["a1"]
arr[1] is ["b2","c2"]
arr[2] is ["d3","e3","f3"]
arr[3] is ["g4","h4","i4","k4"]
silver537
@silver537
Apr 15 2017 02:52
@rlgerman25 NO. that's not even how the actual formula works
@rlgerman25 you're trying to convert celsius to fahrenheit. not fahrenheit to fahrenheit.
Kyle Naumovski
@egnarodrinksOJ
Apr 15 2017 02:53
@heemama I might be late but try var a = b
DJToners
@DJToners
Apr 15 2017 02:53

// Declare your variable here

var myGlobal =10 ;
function fun1(oopsGlobal/2) {
  // Assign 5 to oopsGlobal Here
  oopsGlobal = 5;
}

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
What am I doing wrong?
silver537
@silver537
Apr 15 2017 02:53
@rlgerman25 what is the actual formula???
DJToners
@DJToners
Apr 15 2017 02:54
ignore the/2
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:54
generate function is just an array that just adds a random number between 1 and 4 to an array, play function plays that array in the dome with the flashy lights and bleeps, user input listens to the user events clicking on the button and comparing them to the array - then plays the play function or generate function depending on the comparison being correct or incorrect @GodKingShogun
Joseph
@revisualize
Apr 15 2017 02:54
@capearman Now, if you wanted to access ... the string "b2" you would have to do.
var i = 1;
var j = 0;
arr[i][j];
Caleb Pearman
@capearman
Apr 15 2017 02:54
@revisualize I got that right before you said it. I forgot about 0 being 1
silver537
@silver537
Apr 15 2017 02:55
@capearman good
Saboor Malik
@MathematicsCoding
Apr 15 2017 02:55
@revisualize hey
Can you help me with weather app?
Joseph
@revisualize
Apr 15 2017 02:55
@capearman So, if you have an var arr = [[1,2],[3,4],[5,6,7]]
How do you access 3? Using variables i and j
@MathematicsCoding Hello.
@MathematicsCoding I haven't completed that project.
Saboor Malik
@MathematicsCoding
Apr 15 2017 02:56
Okay
David Amanze
@GodKingShogun
Apr 15 2017 02:56
@HeebieGeeBee yes i know what i am suppose to do. but how would give the user a chance to input before it is compared
rlgerman25
@rlgerman25
Apr 15 2017 02:56
@silver537 T(°F) = T(°C) × 9/5 + 32 that is the formula I know.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:57
@GodKingShogun what do you mean before its compared
you jstu compare every time he clicks
Joseph
@revisualize
Apr 15 2017 02:57

@rlgerman25 There is the function declaration of function convertToF(celsius) { .. You have a function name of convertToF and a parameter of celsius
Parameters are used just like variables. So, inside of the function you can use celsius JUST like any other variable.
If I have this code:

function addThree (num) {
    var result;
    result = num + 3;
    return result;
}

So, when we make the function call of:

addThree(10);

You're calling the function addThree You're also passing a value 10 as an argument.
In the function declaration of function addThree (num) { You see that there is a parameter defined of num
When we do addThree(10) then the value of the parameter num is passed the argument value of ... 10
Then if you follow the code through.. result = num + 3; ... and we know the value of num is 10.
Therefore, if we follow through the function we end up with ... result = 10 + 3; then result = 13; then we return the result.

The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32

Caleb Pearman
@capearman
Apr 15 2017 02:57
@revisualize hold on be back in 30 secs with your answer
Joseph
@revisualize
Apr 15 2017 02:58
FRAK! I missed out! https://www.packtpub.com/packt/offers/free-learning .. yesterday had a book that I actually would want to read. Yet. I missed it.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 02:58
he clicks button > was that right button > yes > ok let him click another button > no > ok give him an annoying sound to indicate its wrong and play the sequence again @GodKingShogun
DJToners
@DJToners
Apr 15 2017 02:59

// Declare your variable here

var myGlobal =10 ;
function fun1(oopsGlobal) {
  // Assign 5 to oopsGlobal Here

  oopsGlobal = 5 ;

}

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:01
in the user input function first thing i do would be to take a slice copy of the squence array then just keep shift elements from it every time the user entered a button that was the same as the first element until the array was empty or he hit a button that didnt match the first element of the array @GodKingShogun
Caleb Pearman
@capearman
Apr 15 2017 03:01
@revisualize
i=1
j=0
Joseph
@revisualize
Apr 15 2017 03:02
@capearman ... Where's the rest?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:02
if array gets empty run the generate function again, if he hits a wrong button - make a noise and run the play function again @GodKingShogun
leetboy
@leetboy
Apr 15 2017 03:02
I think I'm missing a point
Of an exercise

// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
// Your Code Here
if (myObj.hasOwnProperty(checkProp)){
return myObj.checkProp;
}
else{
return "Not Found";
}

}

// Test your code by modifying these values
checkObj("gift");

whoops
Brian
@BrianCodes33
Apr 15 2017 03:02
jQuery(document).ready(function($) {
  $(window).scroll(function() {
    var scrollPos = $(window).scrollTop(),
        navbar = $('.nav');
        console.log(scrollPos);
        console.log(navbar);
    if (scrollPos > 400) {
      navbar.css({"background-color" , "black"});
    }
    }
  );
});
Joseph
@revisualize
Apr 15 2017 03:02
@leetboy 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];
Brian
@BrianCodes33
Apr 15 2017 03:02
any idea what im doing wrong
Joseph
@revisualize
Apr 15 2017 03:03

@capearman Just having

i=1
j=0

Doesn't access the array element.

HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:03
@GodKingShogun its very good to plan things out even if its all in sudo code and flow charts
leetboy
@leetboy
Apr 15 2017 03:03
ok thank you
!
Caleb Pearman
@capearman
Apr 15 2017 03:03
@revisualize
var i = 1;
var j = 0;
arr[i][j];
Joseph
@revisualize
Apr 15 2017 03:04
@capearman Okay.
@capearman How would you use that inside of your nested for loops?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:04
@GodKingShogun this is why i didnt bother to do the simon game, didnt seem all that testing or anything or inspiring
silver537
@silver537
Apr 15 2017 03:05
but a good experience
DJToners
@DJToners
Apr 15 2017 03:05
Can somebody help me?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:06
@GodKingShogun obviously im speaking in very simplistic terms with what im saying, and coding it all might need more thinking out and stuff
Joseph
@revisualize
Apr 15 2017 03:08
@capearman Confused? Stuck? Figure it out?
Caleb Pearman
@capearman
Apr 15 2017 03:09
@revisualize I'm working on it
Joseph
@revisualize
Apr 15 2017 03:09
@capearman I'm here to help. If you get stuck. Ask.
Caleb Pearman
@capearman
Apr 15 2017 03:10
@revisualize
for (var i=0; i<1; i++) {
for (var j=0; j < 0;j++)
}
Joseph
@revisualize
Apr 15 2017 03:10
@capearman No.
@capearman Okay. You're not understanding why you're even creating i or j
This code that you wrote. It 100% correct.

function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i=0; i<arr.length; i++) {
    for (var j=0; j < arr[i].length; j++) {

    }
  }

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
@capearman So, when you do the function call.
multiplyAll([[1,2],[3,4],[5,6,7]]);
@capearman arr gets the value of [[1,2],[3,4],[5,6,7]]
daiwik
@daiwik
Apr 15 2017 03:13
when i use g my code works
but not with +
silver537
@silver537
Apr 15 2017 03:14
one is a quantifier and the other is a flag/
Joseph
@revisualize
Apr 15 2017 03:14
@capearman
arr = [[1,2],[3,4],[5,6,7]];
arr[0]; // [1,2]
arr[0][0]; // 1
arr[0][1]; // 2
arr[1]; // [3,4]
arr[1][0]; // 3
arr[1][1]; // 4
arr[2]; // [5,6,7]
arr[2][0]; // 5
arr[2][1]; // 6
arr[2][2]; // 7
Caleb Pearman
@capearman
Apr 15 2017 03:15
@revisualize okay, I understand that
silver537
@silver537
Apr 15 2017 03:16
the quantifier is specific to each character you want to match.
for instance: /1+/ will match anything with 1, or 11, or 111111111111111111111111111111111111111111111111111111111111111111
but will only stop at that instance and returns.
Joseph
@revisualize
Apr 15 2017 03:16
@capearman If you have i increment by 1 each time the outer loop runs.
@capearman i starts as 0
silver537
@silver537
Apr 15 2017 03:16
because + stands for One or more items
Joseph
@revisualize
Apr 15 2017 03:16
@capearman then the nested for loop start. and j is 0
@capearman Then you can do arr[i][j] and that will get you access to the value 1
If j increments by 1. .. j becomes 1.
arr[i][j] is now .. the value 2
You need to multiply product by the array (arr) values
David Amanze
@GodKingShogun
Apr 15 2017 03:18
@HeebieGeeBee i want to complete all the challenges :smile:
Joseph
@revisualize
Apr 15 2017 03:19
@capearman so.. product times the arr[i][j]
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:19
@GodKingShogun yeah i probably will do too eventually, i just meant i didnt want to bother thinking about and planning it all out and stuff
Caleb Pearman
@capearman
Apr 15 2017 03:19
@revisualize I understand that I need to do that, but how do I do that?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:19
which is kinda what i just did
silver537
@silver537
Apr 15 2017 03:19
the flag, matches globally throughout the string. so you can match for multiple matches of the same
for instance: /1/g will match anytime 1 appears in the string.
so '1you431you4561' will match the first 1 the seventh 1 and the 14th 1
Joseph
@revisualize
Apr 15 2017 03:19
@capearman product *= arr[i][j]; .. or you could write ... product = product * arr[i][j] .. it does the same thing.
silver537
@silver537
Apr 15 2017 03:19
@daiwik i answered your question. good luk
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:20
@GodKingShogun try not to over complicate things
daiwik
@daiwik
Apr 15 2017 03:20
thanks @silver537
CamperBot
@camperbot
Apr 15 2017 03:20
daiwik sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:cookie: 927 | @silver537 |http://www.freecodecamp.com/silver537
Joseph
@revisualize
Apr 15 2017 03:21
@capearman Does that make sense?
@capearman You really need to understand how to work with complex data elements within JavaScript and programming. This concept needs to become okay for you to look at and work with.
Caleb Pearman
@capearman
Apr 15 2017 03:23
@revisualize yes that makes sense. I was trying to do that earlier but nothing I did made sense. It was hard for me to wrap my head around. Thanks for all your help
CamperBot
@camperbot
Apr 15 2017 03:23
capearman sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3748 | @revisualize |http://www.freecodecamp.com/revisualize
silver537
@silver537
Apr 15 2017 03:24
@capearman you cant understand a concept without understanding its prerequisite
Joseph
@revisualize
Apr 15 2017 03:24
@capearman Is there some way I could have explained that better without giving you the answer?
Caleb Pearman
@capearman
Apr 15 2017 03:26
@revisualize I don't think so man. You did a good job. It was a syntax thing for me. I knew what I needed to do but figuring out the string syntax was just hard for me to wrap my head around.
Marvin Bagsby
@bama1254
Apr 15 2017 03:28
very hard in english for me to get the sence in some challenges. can somebody tell me if i on the right path ? thx.

Objects can be thought of as a key/value storage, like a dictionary. If you have tabular data, you can use an object to "lookup" values rather than a switch statement or an if/else chain. This is most useful when you know that your input data is limited to a certain range.

Here is an example of a simple reverse alphabet lookup:

var alpha = {
1:"Z",
2:"Y",
3:"X",
4:"W",
...
24:"C",
25:"B",
26:"A"
};
alpha[2]; // "Y"
alpha[24]; // "C"

var value = 2;
alpha[value]; // "Y"
Instructions
Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.

myCode:

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

// Only change code below this line

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

};

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

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

Joseph
@revisualize
Apr 15 2017 03:28
@bama1254 Your function has declared and initialized the variable result to "". You are not modifying result and your function is returning result. Ergo, you're returning "". You need to modify result to be the value of the property from the object that you created.
@bama1254 The function declaration was set up as... function phoneticLookup(val) giving the function name as phoneticLookup and with the parameter of val. There is more that I could go into (if you want I can) but, I'll sum it up with: Parameters are variable-like objects that represent the values that get passed into your function from the function call (arguments). (You basically treat them like variables.)
So, as we learned in: Accessing Objects Properties with Variables you have to use bracket notation to access an object property with a variable. Example: var num = 42; myObj[num];
Marvin Bagsby
@bama1254
Apr 15 2017 03:31
result = lookup[val]; thx
Fabusuyi David Oluwasegun
@dav4thevid
Apr 15 2017 03:31
please guys im still stuck with Generate Random Whole Numbers with JavaScript challenge.....here is my code

var randomNumberBetween0and19 = Math.floor(Math.random() * 20);

function randomWholeNum() {

  // Only change code below this line.

  return Math.floor(Math.random() * (9 - 0)) + 0;

}
Marvin Bagsby
@bama1254
Apr 15 2017 03:32
@revisualize result = lookup[val]; thx
CamperBot
@camperbot
Apr 15 2017 03:32
bama1254 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3749 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Apr 15 2017 03:32
@bama1254 :+1:
Adam Simonini
@adamsimonini
Apr 15 2017 03:40

Good evening all. I'm doing the Pig Latin challenge in the intermediate scripting part of FCC. My code passes all the tests except the one for "glove", even though it correctly returns "ovelgay"

Can anyone help me out here? What am I missing?

Jason Luboff
@JLuboff
Apr 15 2017 03:41
@collabitron It should be oveglay shouldn't it?
Duy khanh
@buiduykhanh
Apr 15 2017 03:41
i dont know what wrong with my code any one can help ?
function largestOfFour(arr) {
// You can do this!
var a = [];
for(var i = 0; i<arr.length;i++){
arr[i].sort(function(a,b){
return b-a;
});
a.push(arr[i][0]);
}
return a;
}
Adam Simonini
@adamsimonini
Apr 15 2017 03:41
My apologies. My code does return "oveglay"**
Jason Luboff
@JLuboff
Apr 15 2017 03:42
@collabitron Show your code
Vicky Lai
@vickylai
Apr 15 2017 03:42
A project's CSS file is typically called something like "style.css". What's the .js file typically called?
Jason Luboff
@JLuboff
Apr 15 2017 03:43
@derhallim Eh...working on miscellanous (crap I butchered that spelling) node stuff
@collabitron It's probably not liking the helper functions being outside the original function and having global variables, fcc definitely doesnt like global variables
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:45
@JLuboff evening
Jason Luboff
@JLuboff
Apr 15 2017 03:45
@HeebieGeeBee Howdy
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:46
@JLuboff have you used firebase before?
i havent used mongo or anything yet but firebase is very nice
and has some very nice features
Adam Simonini
@adamsimonini
Apr 15 2017 03:47
@JLuboff ah, you might be right about it not running because of that. thanks for looking. still, it's odd that the other tests all pass
CamperBot
@camperbot
Apr 15 2017 03:47
collabitron sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 1513 | @jluboff |http://www.freecodecamp.com/jluboff
Jason Luboff
@JLuboff
Apr 15 2017 03:47
@HeebieGeeBee No, only Mongo, Microsoft SQL and MySQL although MySQL was 8-9 yearrs ago
Samar Adbulbaset
@smr93
Apr 15 2017 03:47
hi
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:48
@JLuboff well you should give it a look, very fancy
Samar Adbulbaset
@smr93
Apr 15 2017 03:48
can any one help me
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:48
especially for little projects
Jason Luboff
@JLuboff
Apr 15 2017 03:48
@HeebieGeeBee Is it free?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:48
yeah
Jason Luboff
@JLuboff
Apr 15 2017 03:48
Alright..I'll take a look
Shikazuka
@Arthareza
Apr 15 2017 03:49
hey guys i'm stuck at Escape Sequences in Strings ?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:49
@JLuboff can even earn money lol
Shikazuka
@Arthareza
Apr 15 2017 03:49
here is my code
var myStr = "\b backslash \t tab \t tab \r carriage-return \n new-line";
Jason Luboff
@JLuboff
Apr 15 2017 03:50
@Arthareza You should reread the instructions and the provided table.
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:50
has section about adding advertising to your apps
Jason Luboff
@JLuboff
Apr 15 2017 03:50
@HeebieGeeBee oh thats neat
Samar Adbulbaset
@smr93
Apr 15 2017 03:53
:(
i was searching for a final project idea then found that google product webVR so i loved it but i dont know if i could do something like or take its api or what
https://developers.google.com/web/fundamentals/vr/
:worried:
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:56
@smr93 what do you want to do exactly?
Samar Adbulbaset
@smr93
Apr 15 2017 03:56
@HeebieGeeBee :(
web final project
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:57
?
final prject for what?
Agung
@agungnursatria
Apr 15 2017 03:57
blob
blob
Samar Adbulbaset
@smr93
Apr 15 2017 03:57
anything intersting with web
Agung
@agungnursatria
Apr 15 2017 03:57
blob
blob
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:58
@smr93 but what would it be?
Samar Adbulbaset
@smr93
Apr 15 2017 03:58
@HeebieGeeBee for my collage :( I'm IT student
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:59
@smr93 ok but i mean what would your project do
Samar Adbulbaset
@smr93
Apr 15 2017 03:59
@HeebieGeeBee did u see that google product webVR
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 03:59
yes
Samar Adbulbaset
@smr93
Apr 15 2017 03:59
@HeebieGeeBee i dont know I'm still searching for an idea
:(
Jason Luboff
@JLuboff
Apr 15 2017 04:00
lol
Samar Adbulbaset
@smr93
Apr 15 2017 04:00
@JLuboff -_-
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:01
@smr93 maybe you can speak to @revisualize he seems to be really into vr stuff
Samar Adbulbaset
@smr93
Apr 15 2017 04:01
mmm
@HeebieGeeBee thanks
CamperBot
@camperbot
Apr 15 2017 04:01
smr93 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1319 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:02
@smr93 what about a vr sculpting app
JEgerton
@JEgerton
Apr 15 2017 04:03
anybody have any experience in powershell?
Mohamed Derhalli
@derhallim
Apr 15 2017 04:03
@JEgerton me
Samar Adbulbaset
@smr93
Apr 15 2017 04:03
@HeebieGeeBee what that :(
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:03
well instead of painting
you make virtual sculptures
Ashan Mohammed
@AshanMohammed
Apr 15 2017 04:04
@AshanMohammed
Hello,
Hello! My bootstrap links doesn't work. Can anybody help?
<ul class="secondnav">
       <li><a href="#">Home &nbsp; | &nbsp; </a></li>
       <li><a href="#">Location &nbsp; | &nbsp;</a></li>
       <li><a href="#">Categories | &nbsp;</a></li>
       <li><a href="#">Contact Us | &nbsp;</a></li>
       <li><a href="#">add</a></li>
     </ul>
.secondnav{
    float: right;
    margin-right: 20px;
}

.secondnav li{
  list-style: none;
  display: inline;
}

.secondnav a{
 color: white; 
}

.secondnav a:hover{
    text-decoration: none;
    color: rgb(200,200,200);
}
JEgerton
@JEgerton
Apr 15 2017 04:04
@derhallim whats a good website to learn how to use
Jason Luboff
@JLuboff
Apr 15 2017 04:04
I know a small bit of powershell
Mohamed Derhalli
@derhallim
Apr 15 2017 04:04
@JEgerton i watched youtube videos, and tried to accomplish some stuff with it , published 3 scripts to codeplex
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:04
@AshanMohammed you dont have anything in href
Jason Luboff
@JLuboff
Apr 15 2017 04:05
I actually took a course on powershell programming....but...don't know a lot of powershell still heh. But I can get around for what I need
JEgerton
@JEgerton
Apr 15 2017 04:05
okay thanks thats what i will continue to do
Ashan Mohammed
@AshanMohammed
Apr 15 2017 04:05
@HeebieGeeBee i mean the cursor pointer doesn't even show up.
Mohamed Derhalli
@derhallim
Apr 15 2017 04:05
@JEgerton u need to apply powershell in something, unlike html/css where u can study and study.. think about something u want to do, and start right away
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:05
@AshanMohammed why would it>
@smr93 sorry i dont want to be going back and forth to pms
JEgerton
@JEgerton
Apr 15 2017 04:06
@derhallim i think i have an idea of what i want to do i just need to learn how to use powershell more
Ashan Mohammed
@AshanMohammed
Apr 15 2017 04:06
@HeebieGeeBee Don't know??
Mohamed Derhalli
@derhallim
Apr 15 2017 04:07
cool
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:07
@AshanMohammed sorry dont understand what your problem is
Jason Luboff
@JLuboff
Apr 15 2017 04:08
If there is one thing I want to perfect...callbacks. I struggle a lot with them in node
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:09
@JLuboff especially sync and a sync
Mohamed Derhalli
@derhallim
Apr 15 2017 04:09
@JLuboff i spent all day aligning the app i showed u yesterday :joy:
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:10
well just async and sync in node in general
Jason Luboff
@JLuboff
Apr 15 2017 04:10
@HeebieGeeBee Ya thats my problem is I'm trying to send data in the response, but the sql database read is still going on when it goes to send
@derhallim :joy:
Mohamed Derhalli
@derhallim
Apr 15 2017 04:11
i hate positions in css
Jason Luboff
@JLuboff
Apr 15 2017 04:11
Mhmm damn right
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:11
@derhallim try understanding flexbox
Mohamed Derhalli
@derhallim
Apr 15 2017 04:11
ummm
but it's still new
Jason Luboff
@JLuboff
Apr 15 2017 04:12
I want to go through the flexbox training on beta, just haven't had time
Mohamed Derhalli
@derhallim
Apr 15 2017 04:12
isn't supported in stupid IE yet?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:12
so?
pffft
fuck ie users
Mohamed Derhalli
@derhallim
Apr 15 2017 04:12
the thing is that I work closely with Microsoft technologies (sharePoint)
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:12
lol
Mohamed Derhalli
@derhallim
Apr 15 2017 04:12
so anything I build I have to take into consideration their IE users..
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:13
fair enough
Mohamed Derhalli
@derhallim
Apr 15 2017 04:13
since most of it is intranets
but yea
it's one thing to knw
Jason Luboff
@JLuboff
Apr 15 2017 04:13
uugggghh I hate how IE handles intranet pages
Mohamed Derhalli
@derhallim
Apr 15 2017 04:13
now Microsoft dropped support for IE10
and IE11 is the last IE
IE was made to serve windows apps :joy:
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:14
did markus say he had to make sure his stuff at work had to run on like ie 6 or summin
Jason Luboff
@JLuboff
Apr 15 2017 04:14
It defaults to fucking IE7 settings...have to force your app to run in Edge mode
Most likely
Mohamed Derhalli
@derhallim
Apr 15 2017 04:14
Edge is yet another improved IE, but for marketing purposes they wanna get rid of the IE shameful name
but it's still an IE
Microsoft is the best at Marketing :joy:
Jason Luboff
@JLuboff
Apr 15 2017 04:16
Correct. It's a decent browser but if they wanted to get rid of IE, they shouldnt have kept an E as the logo
Mohamed Derhalli
@derhallim
Apr 15 2017 04:16
yeaa :joy:
marketing team, but same designer
can u believe when sharepoint was released
it's Microsoft's product
it wasn't compatible with latest version of IE, but it was compatible with chrome/FF
Jason Luboff
@JLuboff
Apr 15 2017 04:17
Yup thats Microsoft for you
Mohamed Derhalli
@derhallim
Apr 15 2017 04:18
i was like :O it's compatible with IE10/9, but not 11???????
where's the arrangement between teams?
and yet.. some stuff work only in IE, not in chrome or FF, like stuff that need active X
Peter Nguyen
@iampeternguyen
Apr 15 2017 04:18
Hey all, I'm working on the profile lookup task in the javascript section. I eventually figured out how to make it work, but I was curious if you had any other tips on how to do it cleaner or more efficiently?

//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


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[i][prop];
        }
    else {
      return "No such property";
    }

  }

}
  return "No such contact";
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:19
just prop in has property @iampeternguyen
but nah thats pretty standard solution
Julian Mansueto
@julianmnst
Apr 15 2017 04:20
guys i'm stuck at Title Case a Sentence challenge
Peter Nguyen
@iampeternguyen
Apr 15 2017 04:20
@HeebieGeeBee what do you mean just prop? no brackets?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:20
yeah you dont need the brackets @iampeternguyen
Peter Nguyen
@iampeternguyen
Apr 15 2017 04:21
cool. thanks @HeebieGeeBee
CamperBot
@camperbot
Apr 15 2017 04:21
iampeternguyen sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1320 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:21
@julianmnst how are you stuck?
i may have just made the greatest game ever
David Miller
@DavidMillerFL
Apr 15 2017 04:22

Hello everyone, I just started Javascript. I have a question. I am at this section

"Compound Assignment With Augmented Addition"

In the details it says "myVar += 5; will add 5 to myVar."

How is this different than just writing "Var myVar +5" ?

Julian Mansueto
@julianmnst
Apr 15 2017 04:24

function titleCase(str) {
  var cad = str.toLowerCase().split(" ");

  for (var i = 0; i <= str.length-1; i++){
    cad[i] = (cad[i].charAt(0)).toUpperCase() + cad[i].slice(1);
  }
  return cad.join(" ");
}

titleCase("I'm a little tea pot");
@HeebieGeeBee this is my code and i'm getting "TypeError: Cannot read property "charAt" of undefined
Ken Haduch
@khaduch
Apr 15 2017 04:24
@DavidMillerFL - myVar += 5 takes the value that is currently in the variable myVar and adds to it, and stores the result back into myVar. What you wrote, myVar +5 will add 5 to myVar, but it will not store it anywhere - you would need myVar = myVar + 5; to store the result back. Is that what you wanted to know?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:26
@julianmnst why is there parentheis around it?
Tanisha Garg
@TanishaGarg
Apr 15 2017 04:26
@DavidMillerFL by placing var in front of your variable you are declaring it and while declaring a variable doesn't have any value before you specify it, so won't be able to add 5 to your variable in such a manner because it doesn't have any value now
Aaron Bell
@awb715
Apr 15 2017 04:26
var openBox = {
  open:['0', '1', '2', '3', '4', '5', '6', '7', '8'],
  live:[]

};

 openBox.live=openBox.open;   // this occurs elsewhere but to show what i am doing
so i at the beginning of my function calls I assign the open array to live,and as the user particpates in the app, the openboxes get removed. When the reset function occurs, its supposed to reassign the full open array back to live. but for some reason it doesnt
Ken Haduch
@khaduch
Apr 15 2017 04:27
@TanishaGarg - in your function setGear, you are not actually assigning the value that you are passing to the function to the gear variable, you are just returning it. I has to be assigned, in order to set the value.
Julian Mansueto
@julianmnst
Apr 15 2017 04:27
@HeebieGeeBee i just removed it. same error. (I was trying random stuff since i don't know what am I doing wrong)
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:27
@julianmnst and the loop needs to be cad.length
Julian Mansueto
@julianmnst
Apr 15 2017 04:27
@HeebieGeeBee THAT WAS IT hahah thank youuu
CamperBot
@camperbot
Apr 15 2017 04:27
julianmnst sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1321 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:27
@HeebieGeeBee i < cad.length
Tanisha Garg
@TanishaGarg
Apr 15 2017 04:28
@khaduch how should i do it
Ken Haduch
@khaduch
Apr 15 2017 04:29
@TanishaGarg gear = change; looks like it should work?
Tanisha Garg
@TanishaGarg
Apr 15 2017 04:29
@khaduch then shouldn't i replace gear with change?
Peter Nguyen
@iampeternguyen
Apr 15 2017 04:31
Math.floor(Math.random() * (max - min + 1)) + min
Math.floor(Math.random() * (max - min + 1)) + min
Ken Haduch
@khaduch
Apr 15 2017 04:31
@TanishaGarg - assign the value in your function argument change to the gear variable, that would be setting the gear
Peter Nguyen
@iampeternguyen
Apr 15 2017 04:31
can someone explain why the + 1 is necessary?
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:31
@iampeternguyen cus math floor round down
so the +1 compensates
otherwise you'll never get the max value randomely generated
Peter Nguyen
@iampeternguyen
Apr 15 2017 04:34
ohh okay. I was like doing mental math if the number was too low, but that makes way more sense now. thanks again @HeebieGeeBee
CamperBot
@camperbot
Apr 15 2017 04:34
iampeternguyen sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:warning: iampeternguyen already gave heebiegeebee points
Tanisha Garg
@TanishaGarg
Apr 15 2017 04:35
HeebieGeeBee
@HeebieGeeBee
Apr 15 2017 04:35
@TanishaGarg i thought @khaduch did
Ken Haduch
@khaduch
Apr 15 2017 04:36
@TanishaGarg - I see another problem in your code - you have a function argument in the getGear function - you should eliminate that. It is causing it to return an undefined value, because you are not going to be passing a value to the getGear function, leaving gear (a local variable in that function) as an undefined value. that is causing a rpoblem.
@TanishaGarg - if you can post an updated copy of your code, I can check to see what is happening there, if you haven't made the two changes that I indicated you need to make.
@khaduch
Ken Haduch
@khaduch
Apr 15 2017 04:41
@TanishaGarg - no, not quite right. Your getGear function should have return gear; as the code. And your setGear function should be setting gear, so it should have gear = change; as its code.
Tanisha Garg
@TanishaGarg
Apr 15 2017 04:41
@khaduch and my setGear function should be returning change?
Ken Haduch
@khaduch
Apr 15 2017 04:43
Your setGear function doesn't have to return anything, although after you set gear, you could probably return either gear or change because they will then be the same value. But in my solution, I did not return a value from setGear. If you follow the example of the Car that they show, the functions that change the speed do not return any value. But try it both ways for the Bike and see if it makes a difference in the tests?
Tanisha Garg
@TanishaGarg
Apr 15 2017 04:45
@khaduch but i am quite not getting that what is happening or what is supposed to happen in this challenge and how?
David Miller
@DavidMillerFL
Apr 15 2017 04:48
@khaduch Thank you for the infi, I was AFK
CamperBot
@camperbot
Apr 15 2017 04:48
davidmillerfl sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2740 | @khaduch |http://www.freecodecamp.com/khaduch
David Miller
@DavidMillerFL
Apr 15 2017 04:48
info*
Ken Haduch
@khaduch
Apr 15 2017 04:49
@TanishaGarg - you are making a new object that has a private variable. The private variable (or rather, property) is called gear. The only way that you can access the value of the private property is to create methods that have access to it - those are the two functions setGear (which should take the parameter that you pass to it, and assign it to the private variable gear, similar to what the example object Car does with accelerate and decelerate, except that instead of adding or subtracting, it is just assigning the value directly to the variable.) Then the other function getGear, which should have no function argument, is simply going to return whatever value is in the private property gear. So just return gear; It is a standard technique that is used in object oriented programming, and they are just showing how you do it with this simple example and problem.
Tanisha Garg
@TanishaGarg
Apr 15 2017 04:51
@khaduch thanks a lot!
CamperBot
@camperbot
Apr 15 2017 04:51
tanishagarg sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2741 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
Apr 15 2017 04:55
@TanishaGarg - you're welcome - I hope that it makes sense! Good luck!
francescacosta
@francescacosta
Apr 15 2017 05:08
Hi all! Hope you are well, having a bit of trouble on the "Using Objects for Lookups"
all I have right now is lookup.val... and I know that's completely wrong, but I can't get any further than that with my brain
Tanisha Garg
@TanishaGarg
Apr 15 2017 05:10
@francescacosta send your code
Makrand R
@makrandr
Apr 15 2017 05:11
Well looking for feedback on this
http://codepen.io/makrandr/full/qrzMxJ
When ya loading it for the first time,the image transition ain't that smooth and images also aren't fitting the page width.
Moisés Man
@moigithub
Apr 15 2017 05:15
@francescacosta val is a variable
NO dot notation with variables
francescacosta
@francescacosta
Apr 15 2017 05:17
thankyou guys, I was able to figure it out :) @moigithub @ptdtan
CamperBot
@camperbot
Apr 15 2017 05:17
francescacosta sends brownie points to @moigithub and @ptdtan :sparkles: :thumbsup: :sparkles:
:cookie: 16 | @ptdtan |http://www.freecodecamp.com/ptdtan
:star2: 3096 | @moigithub |http://www.freecodecamp.com/moigithub
Jack Henry Sadang
@JackCodr
Apr 15 2017 05:36
Hi, I love girls
Ogundele Olumide
@Lumexralph
Apr 15 2017 05:47
@JackCodr :smirk:
james umali
@indefinite0212
Apr 15 2017 05:49
loko haha
Darth Skywalker
@adityaparab
Apr 15 2017 05:49
@JackCodr We're gonna be bffs!
Jor
@joreyesl
Apr 15 2017 06:10
u like grils?
Carl Tamayo
@tanotamayo
Apr 15 2017 06:13

can someone help me on this?
function nextInLine(arr, item) {
// Your code here

return item; // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

Wing Ng
@citrusapple
Apr 15 2017 06:17
I like women more than girls, on another note, please help....
I'm being told my array.sort is not a function for some reason my var array returns as a single number not an array.... am I supposed to have an empty array set first?
function getIndexToIns(arr, num) {
  // Find my place in this sorted array.
  var args = Array.prototype.slice.call(arguments);
  var array = args.unshift(num);
  var newArray = array.sort(function(a,b){
    return b-a;
  });
  var answer= newArray.indexOf(num);
  return answer;
}

getIndexToIns([40, 60], 50);
SaiChand Duppala
@saichandd
Apr 15 2017 06:17
@tanotamayo whats supposed to be done?
Carl Tamayo
@tanotamayo
Apr 15 2017 06:18
@theNuclearman nextInLine([], 1) should return 1
nextInLine([2], 1) should return 2
nextInLine([5,6,7,8,9], 1) should return 5
After nextInLine(testArr, 10), testArr[4] should be 10
i didnt get it seriously
SaiChand Duppala
@saichandd
Apr 15 2017 06:20
@tanotamayo what the hell, link the question
SaiChand Duppala
@saichandd
Apr 15 2017 06:22
@tanotamayo if you didn't undestand what queue is, read this first
Wing Ng
@citrusapple
Apr 15 2017 06:22
@tanotamayo pretty sure it's testing .push and .shift
Carl Tamayo
@tanotamayo
Apr 15 2017 06:23
thanks dude @theNuclearman
CamperBot
@camperbot
Apr 15 2017 06:23
tanotamayo sends brownie points to @thenuclearman :sparkles: :thumbsup: :sparkles:
:cookie: 251 | @thenuclearman |http://www.freecodecamp.com/thenuclearman
Jor
@joreyesl
Apr 15 2017 06:23

@citrusapple .unshift() will return the new length of the array, not a reference to the array. So what you are assigning to array is a number, not an array. So when you call array.sort() you are attempting to call it on a number.

Also you don't need to do this step var args = Array.prototype.slice.call(arguments);, you already have the arr and num parameters. In this case you want to unshift on arr

Wing Ng
@citrusapple
Apr 15 2017 06:27
@joreyesl i thought .unshift is supposed to add an element to the beginning of an array? if it returns a number of the length of the array, what do I do to get the array itself back?
thanks for letting me know I don't need
'''
var args = Array.prototype.slice.call(arguments);
'''
I didn't actually understand why we needed that for "seek and destroy" until now.
Jor
@joreyesl
Apr 15 2017 06:31
@citrusapple yes .unshift() does add an element to the beginning, but the return value of that method is not an array reference, instead it will return the new length.
Ex:
var arr = [1,2,3];
var n = arr.unshift(4); // n = 4, the new length of the array.
console.log(arr); // [4,1,2,3], unshift mutates arr
Wing Ng
@citrusapple
Apr 15 2017 06:32
@joreyesl hmmm I think I get it, let me try again
i'll brb