2nd
Nov 2016
Diego Mayer
@Chrono79
Nov 02 2016 00:00
Nikola
@NIDZAAAAA
Nov 02 2016 00:00
There is no code yet, i don`t know where to satrt

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

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

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

Diego Mayer
@Chrono79
Nov 02 2016 00:00
@NIDZAAAAA use the algorithm they gave you
Nikola
@NIDZAAAAA
Nov 02 2016 00:00
i know, but i don`t know how...
Diego Mayer
@Chrono79
Nov 02 2016 00:01
what's the var you should return? You need to set its value, so you have to write it left of the = sign
Then you have to translate the word plus and times to the right math operators
Fahrenheit is the temperature in Celsius times 9/5, plus 32.
ehutchllew
@ehutchllew
Nov 02 2016 00:03
@awb715 wow nvm, i'm dumb. I was calling the wrong key
Nikola
@NIDZAAAAA
Nov 02 2016 00:06
@Chrono79 var is fahrenheit. So first is fahrenheit = 9/5 +32 ?
Diego Mayer
@Chrono79
Nov 02 2016 00:06
@NIDZAAAAA you forgot celsius in there, but you're close
Walid Ashri
@walidashri
Nov 02 2016 00:07
@Chrono79 Hola. You still here? :O
Diego Mayer
@Chrono79
Nov 02 2016 00:07
yes
Nikola
@NIDZAAAAA
Nov 02 2016 00:08
fahrenheit = 0 + 9/5 +32; ?
Diego Mayer
@Chrono79
Nov 02 2016 00:08
being afk for some hours and I'm back
@NIDZAAAAA no, where is celsius?, read the algorithm again
Walid Ashri
@walidashri
Nov 02 2016 00:09
@NIDZAAAAA what is the result of your equation now?
Nikola
@NIDZAAAAA
Nov 02 2016 00:10
33.8
Walid Ashri
@walidashri
Nov 02 2016 00:10
and every time it'll be nothing gonna change
Michael Pope
@MichaelPopeDeveloper
Nov 02 2016 00:11
On the word blank assignment, what do they mean it should be separated by non word characters?

var result = "";
// Your code below this line

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("cat", "little", "hit", "slowly");

Walid Ashri
@walidashri
Nov 02 2016 00:11
So u need to use the var as @Chrono79 said
@cold2stonefire just make a sentience of these variables
Diego Mayer
@Chrono79
Nov 02 2016 00:12
@cold2stonefire it means your words shouldn't be glued together like this catlittlehitslowly
it also says this `(and any additional words in your madlib).`
Michael Pope
@MichaelPopeDeveloper
Nov 02 2016 00:17

like this?
var result = "";
// Your code below this line

result = "" + myNoun + " " + myAdjective + " " myVerb + "_ " + myAdverb;
// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("cat", "little", "hit", "slowly");

Diego Mayer
@Chrono79
Nov 02 2016 00:18
@cold2stonefire they shouldn't be necessarily non word chars, they can be words, put some on your own, like "My " + myNoun + etc, the blanks you wrote should be used by the parameters of your function
Michael Pope
@MichaelPopeDeveloper
Nov 02 2016 00:22
@Chrono79 thanks!
CamperBot
@camperbot
Nov 02 2016 00:22
cold2stonefire sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2408 | @chrono79 |http://www.freecodecamp.com/chrono79
Michael Pope
@MichaelPopeDeveloper
Nov 02 2016 00:23
@walidashri Thanks!
CamperBot
@camperbot
Nov 02 2016 00:23
cold2stonefire sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Conor Murphy
@cmurphy580
Nov 02 2016 00:27
@Chrono79 I can't get this dang thing to work. Here's what I have.
``` ```
Aaron Bell
@awb715
Nov 02 2016 00:27
anyone familiar with hover.css?
Conor Murphy
@cmurphy580
Nov 02 2016 00:27
``````if ((randomQuote + author).length > 80) {
randomQuote = randomQuote.slice(0,80) + "...";
}
\$("#tweet").on("click", function(){
});``````
Diego Mayer
@Chrono79
Nov 02 2016 00:29
Diego Mayer
@Chrono79
Nov 02 2016 00:32
@dampish 'use strict'; is not a string you should use to set myVar value, leave that line alone and use some other string
also you deleted this comment: `// Now remove the console log line to pass the test`
James
@dampish
Nov 02 2016 00:33
@Chrono79 Yes. Thank you! :)
CamperBot
@camperbot
Nov 02 2016 00:33
dampish sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2409 | @chrono79 |http://www.freecodecamp.com/chrono79
Gerald Watanabe
@islandwebtek
Nov 02 2016 00:33
Check for Palindromes Challenge I assume the first step is to remove anything that is not a letter or number?
Diego Mayer
@Chrono79
Nov 02 2016 00:34
@islandwebtek yes (don't forget to level you chars)
Gerald Watanabe
@islandwebtek
Nov 02 2016 00:35
Would RegEx work here?
Diego Mayer
@Chrono79
Nov 02 2016 00:35
@islandwebtek sure
Gerald Watanabe
@islandwebtek
Nov 02 2016 00:36
OK let me play with it than attempt to make sure everything is lowercase
Nov 02 2016 00:37

im really struggling with the twitch API. I have a list of 8 users, but the return from the request is really inconsistent. Sometimes Iâ€™ll get 2, sometimes Iâ€™ll get 5, but never the full 8. link below

is the request timing out?
jrandallhansen
@jrandallhansen
Nov 02 2016 00:42
Nov 02 2016 00:43
@jrandallhansen thanks!
CamperBot
@camperbot
Nov 02 2016 00:43
adamakers sends brownie points to @jrandallhansen :sparkles: :thumbsup: :sparkles:
Diego Mayer
@Chrono79
Nov 02 2016 00:44
@foreverifilm why did you create another object?
Instructions
Read in the property values of testObj using dot notation. Set the variable hatValue equal to the object property hat and set the variable shirtValue equal to the object property shirt.
Aaron Bell
@awb715
Nov 02 2016 00:44
anyone familiar with hover.css?
Walid Ashri
@walidashri
Nov 02 2016 00:45
@awb715 whats up
Aaron Bell
@awb715
Nov 02 2016 00:45
im trying to make my temperature have an effect on a hover
jrandallhansen
@jrandallhansen
Nov 02 2016 00:46
@adamakers I think your issue may have to do with the `for` loop being too fast for the api calls. i remember i had an issue similar. let me see how it worked out
Aaron Bell
@awb715
Nov 02 2016 00:46
@walidashri and i added the style sheet in my header in codepen. im just figuring out how i had when the temperature is getting queried when the api data comes in
jrandallhansen
@jrandallhansen
Nov 02 2016 00:48
@adamakers I think it does have to do with that same issue. Try rewriting in a format in which the URL variables are created within the loop enclosure as a temporary instance. that should resolve the issue
Nov 02 2016 00:48
@jrandallhansen Is that an async thing? Thats what I initially thought, but doesnt the \$.ajax has some async stuff built in?
@jrandallhansen iâ€™ll give that a shot
jrandallhansen
@jrandallhansen
Nov 02 2016 00:50
@adamakers it is an async issue. i recommend setting `async: false,` in your `\$.ajax` call but still you need to create an enclosure within the loop
anyone up for trying to help me debug my "exact change" algorithm?
``````function checkCashRegister(price, cash, cid) {
//OPERATE IN INTEGERS BY MULTIPLYING BY 100
cash = cash * 100;
price = price * 100;
//DEFINE VARIABLES TO HOLD CASH-IN-DRAWER, TOTAL CHANGE, CHANGE REMAINING, AND RESULTS
var changeTotal = cash - price;
var changeRemaining = cash - price;
var cashInDrawer = getCashTotal(cid);
var changeDueArray = [];
function getCashTotal(cid) {
var total = 0;
for (var i = 0; i < cid.length; ++i) {
total += cid[i][1] * 100;
}
}
//WRITE FUNCTION TO RETURN TENDER VALUE
function getTenderValue(tender) {
switch (tender) {
case 'PENNY':
return 1;
case 'NICKEL':
return 5;
case 'DIME':
return 10;
case 'QUARTER':
return 25;
case 'ONE':
return 100;
case 'FIVE':
return 500;
case 'TEN':
return 1000;
case 'TWENTY':
return 2000;
case 'ONE HUNDRED':
return 10000;
default:
return undefined;
}
}
//PROVIDE INSTRUCTIONS FOR EACH CONDITION
if (changeTotal === cashInDrawer) {
console.log("Closed");
} else if (changeTotal > cashInDrawer) {
console.log("Insufficient Funds");
} else {
//LOOP OVER CASH-IN-DRAWER ARRAY FROM LARGEST TO SMALLEST TO ASSIGN CHANGE DUE
for (var i = cid.length - 1; i >= 0; i--) {
var tenderID = cid[i][0]; //ASSIGN NAME OF CURRENT TENDER
var tenderTotal = cid[i][1] * 100; //CALCULATE TOTAL CASH-IN-DRAW OF ASSIGNED TENDER
var tenderValue = getTenderValue(tenderID); //ASSIGN VALUE OF SELECTED TENDER
var tenderUnits = tenderTotal / tenderValue; //CALCULATE AMOUNT OF UNITS FOR ASSIGNED TENDER
var unitsToReturn = 0; //COUNTER VALUE OF HOW MANY UNITS OF ASSIGNED TENDER TO RETURN
//WHILE CHANGE DUE IS ABOVE VALUE OF TENDER IN DRAWER AND UNITS OF TENDER REMAIN ITERATE VALUES
while (changeRemaining >= tenderTotal && tenderUnits > 0) {
unitsToReturn++;
tenderUnits--;
changeRemaining -= tenderValue;
}
//IF UNITS OF TENDER ARE DUE THEN PUSH THE TENDER NAME AND VALUE TO CHANGE DUE ARRAY
if (unitsToReturn > 0) {
changeDueArray.push([tenderID, unitsToReturn * tenderValue / 100]);
}
}
}
//USE IF STATEMENT TO MAKE SURE THAT CASH IN OUR CHANGE DUE ARRAY IS EQUAL TO CHANGE
if (getCashTotal(changeDueArray) != changeTotal) {
return "Insufficient Funds"; //IMPROPER BILLS TO PROVIDE CHANGE RETURN ERROR MESSAGE
}
//CONSOLE.LOG AND RETURN STATEMENTS
console.log(changeTotal);
console.log(changeRemaining);
console.log(cashInDrawer);
console.log(changeDueArray);
return changeDueArray;
}

checkCashRegister(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);``````
Aaron Bell
@awb715
Nov 02 2016 00:54
@walidashri you there?
Walid Ashri
@walidashri
Nov 02 2016 00:58
@awb715 here u can use window.onload
Conor Murphy
@cmurphy580
Nov 02 2016 00:59
@Chrono79 I got the it shorten the quote to fit in the twitter box, but I'm trying to add a freaking "#fcc" to it. I put it by the ellipsis but then for some reason that takes out the author.http://codepen.io/cmurphy580/pen/dpLBYz
Garrus Napp
@GarrusNapp
Nov 02 2016 01:03
@cmurphy580 I think the whole point of random generator challange was to teach you using API
and you hardcoded the quotes :D
Aaron Bell
@awb715
Nov 02 2016 01:04
@GarrusNapp @cmurphy580 i dindt use api in the quote generator. i wanted to understand object based querying
but i didnt do a twitter
Diego Mayer
@Chrono79
Nov 02 2016 01:05
jrandallhansen
@jrandallhansen
Nov 02 2016 01:05
@GarrusNapp I actually asked Quincy Larson about API on this project and he said dont use it. use API on twitter. lol kind of random but true
Garrus Napp
@GarrusNapp
Nov 02 2016 01:06
@jrandallhansen interesting! Sorry for the misinfo then
Ryan Williams
@RyWilliams
Nov 02 2016 01:06
@cmurphy580 if you want to put it after the [...] you have the url encode the #
can add it with +' %23fcc'
Stephen James
@sjames1958gm
Nov 02 2016 01:07
@cmurphy580 Your author appears to have a `-` in it if you look at the URL on the new page
Garrus Napp
@GarrusNapp
Nov 02 2016 01:08
@cmurphy580 also use encodeURIComponent otherwise your quotes will cut on some characters while trying to tweet them
Stephen James
@sjames1958gm
Nov 02 2016 01:08
@cmurphy580 Exactly encode the URL
`https://twitter.com/intent/tweet?text=Astronomy%20compels%20the%20soul%20to%20look%20upward,%20and%20leads%20us%20from%20this%20world%20to%20another.-%20Plato`
Conor Murphy
@cmurphy580
Nov 02 2016 01:09
@GarrusNapp well damn! @awb715 you just add the .getJSON function right?
Aaron Bell
@awb715
Nov 02 2016 01:09
yes now that im almost done with weather app, i understand
Garrus Napp
@GarrusNapp
Nov 02 2016 01:10
@awb715 you managed to get those icons to work?
Conor Murphy
@cmurphy580
Nov 02 2016 01:10
@sjames1958gm @GarrusNapp @sjames1958gm @RyWilliams @Chrono79 Alright let me see what I can do. thanks for the help
CamperBot
@camperbot
Nov 02 2016 01:10
cmurphy580 sends brownie points to @sjames1958gm and @garrusnapp and @rywilliams and @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2410 | @chrono79 |http://www.freecodecamp.com/chrono79
:star2: 4122 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Aaron Bell
@awb715
Nov 02 2016 01:10
yes @GarrusNapp check out the code
Garrus Napp
@GarrusNapp
Nov 02 2016 01:11
@awb715 damn, looks awesome
Stephen James
@sjames1958gm
Nov 02 2016 01:11
@jrandallhansen What issue are you having with your exact change?
Garrus Napp
@GarrusNapp
Nov 02 2016 01:12
@awb715 and nice F <--> C converting
Aaron Bell
@awb715
Nov 02 2016 01:12
thanks @GarrusNapp
CamperBot
@camperbot
Nov 02 2016 01:12
awb715 sends brownie points to @garrusnapp :sparkles: :thumbsup: :sparkles:
Aaron Bell
@awb715
Nov 02 2016 01:13
having small issue tho
well do you see how there is wi-owm-day-803 , wi-owm-803 wi-owm-night-803
Stephen James
@sjames1958gm
Nov 02 2016 01:13
@awb715 The time seems off
Aaron Bell
@awb715
Nov 02 2016 01:13
all using same id, but show different icons depending on the time of day if you program it that way
thats another issue @sjames1958gm, that relates to this issue im bringing up
the issue related to the different icons from https://erikflowers.github.io/weather-icons/api-list.html depnding on the time. the time from the api using UTC data, and relating it all together
Stephen James
@sjames1958gm
Nov 02 2016 01:17
@awb715 The time is the time of the data calculation.
@adamakers It is best you learn to \$.ajax with async - no real website is going to use synchronous ajax
Aaron Bell
@awb715
Nov 02 2016 01:19
wouldnt it be from when the request gets sent? http://openweathermap.org/current
@sjames1958gm do you also understand my icon issue
Stephen James
@sjames1958gm
Nov 02 2016 01:19
`dt Time of data calculation, unix, UTC` from openweather page
Aaron Bell
@awb715
Nov 02 2016 01:20
ok
Asher Shafqat
@ashslash
Nov 02 2016 01:22
``````function phoneticLookup(val) {
var result = "";

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

// Change this value to test
phoneticLookup();``````
Hi, Im using objects for lookup but I cant figure it out, as in how to assign result to the object lookup, and lookup the values ?
Stephen James
@sjames1958gm
Nov 02 2016 01:23
@awb715 new Date() is current time
@ashslash You need to use val for your look (remember val is a variable)
Fernando Sugianto
@fyzz100
Nov 02 2016 01:24
Stuck at Counting Cards,Anyone can help?
Manish Giri
@Manish-Giri
Nov 02 2016 01:24
@ashslash lookup is the object, and val is the property whose value you need to return from lookup
Nov 02 2016 01:24
@sjames1958gm I'm looking at Promises right now. Would that be the proper step or overcomplicating it?
Manish Giri
@Manish-Giri
Nov 02 2016 01:24
@fyzz100 code?
Stephen James
@sjames1958gm
Nov 02 2016 01:24
@adamakers If you are willing to learn promises that is a good step.
Nov 02 2016 01:25
@sjames1958gm right now thats the only solution i am finding. Is there another method I should look at?
Aaron Bell
@awb715
Nov 02 2016 01:25
@sjames1958gm
Fernando Sugianto
@fyzz100
Nov 02 2016 01:25

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

``````if(count > 0) {
return count +" Bet";
} if (count <= 0) {``````

return count + " Hold";}}

Aaron Bell
@awb715
Nov 02 2016 01:25
"jQuery.Deferred exception: newDate is not defined" "ReferenceError: newDate is not defined
at HTMLDocument.<anonymous> (pen.js:88:15)
at j (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js:2:29568)
at k (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js:2:29882)" undefined
Conor Murphy
@cmurphy580
Nov 02 2016 01:26
Cool! Got it done. Just need to work on some design aspects in html and css, but in terms of functionality, it does what I want it to do. Take a look. Give me some feedback. http://codepen.io/cmurphy580/pen/dpLBYz
Stephen James
@sjames1958gm
Nov 02 2016 01:26
@awb715 space between new and Date()
Manish Giri
@Manish-Giri
Nov 02 2016 01:26
@fyzz100 your idea is right, but the syntax for case is wrong
Fernando Sugianto
@fyzz100
Nov 02 2016 01:26
@Manish-Giri what does syntax for case mean?
Asher Shafqat
@ashslash
Nov 02 2016 01:27
@Manish-Giri @sjames1958gm but the object name is what you use to retrieve the property and their values ?
so what should I do ?
Stephen James
@sjames1958gm
Nov 02 2016 01:28
@ashslash The object name isn't the problem you need to retrieve the value using the property name in val
Manish Giri
@Manish-Giri
Nov 02 2016 01:28
@ashslash yes, and that part is right, but while you're using the object name (lookup) correctly, you need to use the variable `val` as the property name, not alpha
Stephen James
@sjames1958gm
Nov 02 2016 01:29
@adamakers You can save the responses as you get them, counting them and processing when you receive all the responses. You will need to process in the \$.ajax callback.
Nov 02 2016 01:29
@sjames1958gm but I'm not getting all the responses that I should
have 8 users in my list, only returning 2-5
Stephen James
@sjames1958gm
Nov 02 2016 01:30
@adamakers hmm, I see, let me look again
Aaron Bell
@awb715
Nov 02 2016 01:30
thanks @sjames1958gm
CamperBot
@camperbot
Nov 02 2016 01:30
awb715 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4123 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Asher Shafqat
@ashslash
Nov 02 2016 01:31

@Manish-Giri

``lookup[val];``

like this ? but how do I assign all this to result ?

Nov 02 2016 01:31
@sjames1958gm my console.log prints out the returning objects
Asher Shafqat
@ashslash
Nov 02 2016 01:31
also, it's giving the error in console
Joseph
@revisualize
Nov 02 2016 01:31
@ashslash How do you assign the value 7 to a variable `num`?
Manish Giri
@Manish-Giri
Nov 02 2016 01:31
@ashslash just `result =` on the left?
Asher Shafqat
@ashslash
Nov 02 2016 01:32
@revisualize var num = 7
bluehabit
@bluehabit
Nov 02 2016 01:32
Anyone on that might be able to help me with some CSS?
Joseph
@revisualize
Nov 02 2016 01:32
@ashslash Great. How do you assign `lookup[val]` to the vairable `result`?
Fernando Sugianto
@fyzz100
Nov 02 2016 01:33

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

``````if(count > 0) {
return count +" Bet";
} if (count <= 0) {``````

return count + " Hold";}}

Asher Shafqat
@ashslash
Nov 02 2016 01:33
got it , actually since result does not need a 'var' , and @Manish-Giri 's instructions were pretty clear
Stephen James
@sjames1958gm
Nov 02 2016 01:33
@adamakers Try changing your callback to ? (this lets jquery provide the callback function)
var apiUrlTail = '?callback=?';
@fyzz100 Don't change count to "" - if 7, 8, 9 just leave countr alone
@fyzz100 Looks like your switch extends past your count > 0 test??
Nov 02 2016 01:35
@sjames1958gm i'll give that a shot
Asher Shafqat
@ashslash
Nov 02 2016 01:35
@revisualize @sjames1958gm @Manish-Giri Thanks guys, the challange is over, but im still a little confused as to how we ended up using val, instead of the assigned object name .. as the previous challenges taught us ... e.g lookup.alpha // gives you the value of that property
CamperBot
@camperbot
Nov 02 2016 01:35
ashslash sends brownie points to @revisualize and @sjames1958gm and @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2158 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 2188 | @revisualize |http://www.freecodecamp.com/revisualize
:star2: 4124 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Fernando Sugianto
@fyzz100
Nov 02 2016 01:35
@sjames1958gm how to leave it alone? O.O
Stephen James
@sjames1958gm
Nov 02 2016 01:35
@fyzz100 delete the line
Nov 02 2016 01:36
@sjames1958gm wow... that worked! thanks man! But why wasn't it letting me specify my own callback?
CamperBot
@camperbot
Nov 02 2016 01:36
adamakers sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4125 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 02 2016 01:36
@ashslash This is a function with a passed in value `val` so the lookup is based on the contents of that
variable - that is what makes functions useful that they can be used with different values.
Fernando Sugianto
@fyzz100
Nov 02 2016 01:36
@sjames1958gm nothing shows out in the output Q.Q
Stephen James
@sjames1958gm
Nov 02 2016 01:36
@adamakers You didn't supply the function ?
Conor Murphy
@cmurphy580
Nov 02 2016 01:36
alright I tae that back. I run this to shorten my quotes, but it only works once for the long quotes. Does any one have any ideas to get it to work multiple times?
``````if ((randomQuote + author).length <= 90) {
randomQuote = randomQuote;
} else {
randomQuote=
[randomQuote.substr(0,90) + " [...] "];
}
\$("#tweet").on("click", function(){

});``````
Manish Giri
@Manish-Giri
Nov 02 2016 01:36

@ashslash here's a quick explanation -

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

`lookup.alpha` will give you the value of the property `alpha` which is `Adams`
similarly, `lookup.bravo` will give you the value `Boston`

But then what would you do if you were given a variable `x` and told that this variable `x` is a property in the object `lookup`, and you need the value for this property. Surely, you can't use alpha or bravo then?

Stephen James
@sjames1958gm
Nov 02 2016 01:37
@fyzz100 What do you have now?
Fernando Sugianto
@fyzz100
Nov 02 2016 01:38

@sjames1958gm
switch (card) {
case 2 : case 3 : case 4 : case 5 : case 6 :
++count ;break;
case 7 : case 8 : case 9 :
break;
case 10 : case 'J' : case 'Q' : case 'K' : case 'A' :
--count ;

``````if(count > 0) {
return count +" Bet";
} if (count <= 0) {``````

return count + " Hold";}}}

Nov 02 2016 01:38
@sjames1958gm not sure I get what you mean. Before in my `\$.ajax` call I specified the `callback: 'mycallback'`
Manish Giri
@Manish-Giri
Nov 02 2016 01:38
@ashslash when you have a property name contained in a variable, and you need to lookup that property's value from an object, you use the bracket notation, that's why you did `lookup[val]`. More info here - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors
Stephen James
@sjames1958gm
Nov 02 2016 01:38
@fyzz100 You have }}} after " Hold"; the first of these is then end of the switch
It should be moved up after --count
@adamakers And where is mycallback defined as a function?
Joseph
@revisualize
Nov 02 2016 01:38
@ashslash Dot Notation is a 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.
Asher Shafqat
@ashslash
Nov 02 2016 01:38
@Manish-Giri ...Ahh, thats where the 'adding new property' in the object challange comes in ? by assigning 'val', to lookup
Stephen James
@sjames1958gm
Nov 02 2016 01:41
@adamakers You have mycallback as a string which is why it failed silently. It just check if that was a function if not it just threw the data away
Fernando Sugianto
@fyzz100
Nov 02 2016 01:41
@sjames1958gm I deleted a }
the output is blank,nothing appears...
Connor O'Shea
@foreverifilm
Nov 02 2016 01:41
@Chrono79 Thanks
CamperBot
@camperbot
Nov 02 2016 01:41
foreverifilm sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2411 | @chrono79 |http://www.freecodecamp.com/chrono79
Stephen James
@sjames1958gm
Nov 02 2016 01:42
@fyzz100 I didn't say delete I said move it up after the line with --count.
you need to end the switch before you do `if (count > 0)`
Asher Shafqat
@ashslash
Nov 02 2016 01:43
@Manish-Giri @sjames1958gm @revisualize Thanks guys, cheers !
CamperBot
@camperbot
Nov 02 2016 01:43
ashslash sends brownie points to @manish-giri and @sjames1958gm and @revisualize :sparkles: :thumbsup: :sparkles:
:warning: ashslash already gave manish-giri points
:warning: ashslash already gave revisualize points
:warning: ashslash already gave sjames1958gm points
Fernando Sugianto
@fyzz100
Nov 02 2016 01:43
@sjames1958gm THANKS IT WORKSSS!!
CamperBot
@camperbot
Nov 02 2016 01:43
fyzz100 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4126 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 02 2016 01:44
@fyzz100 :+1: Give some credit to @Manish-Giri
Nov 02 2016 01:44
@sjames1958gm so should I have defined mycallback as the success function then?
Fernando Sugianto
@fyzz100
Nov 02 2016 01:45
@sjames1958gm how can i do that?
Stephen James
@sjames1958gm
Nov 02 2016 01:45
@adamakers I am not sure - I was trying it and was not successful -
@fyzz100 Just like you thanked me
Fernando Sugianto
@fyzz100
Nov 02 2016 01:46
@Manish-Giri thank you!
CamperBot
@camperbot
Nov 02 2016 01:46
fyzz100 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2159 | @manish-giri |http://www.freecodecamp.com/manish-giri
Stephen James
@sjames1958gm
Nov 02 2016 01:46
@adamakers Using the ? just lets jQuery do the jsonp callback then your success gets nice pretty js object
Manish Giri
@Manish-Giri
Nov 02 2016 01:47
@ashslash welcome
haha, ty! appreciated @sjames1958gm
CamperBot
@camperbot
Nov 02 2016 01:47
manish-giri sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4127 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Manish Giri
@Manish-Giri
Nov 02 2016 01:47
@fyzz100 welcome
Stephen James
@sjames1958gm
Nov 02 2016 01:47
@Manish-Giri :+1:
Aaron Bell
@awb715
Nov 02 2016 01:52
anyone familiar with all the api weather descriptions for open weather api? i want to change the background color based on the type of weather
Pascale
@pascale-dewingaerde
Nov 02 2016 01:53

Hello, could you tell me what wrong with my code?
// Setup
var collection = {
"2548": {
"album": "Slippery When Wet",
"artist": "Bon Jovi",
"tracks": [
"Let It Rock",
"You Give Love a Bad Name"
]
},
"2468": {
"album": "1999",
"artist": "Prince",
"tracks": [
"1999",
"Little Red Corvette"
]
},
"1245": {
"artist": "Robert Palmer",
"tracks": [ ]
},
"5439": {
"album": "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
if (collection[id][prop] == "tracks"){
if (myObj.hasOwnProperty(prop)){
collection[id][prop].push(value);
}else{
collection[id][prop] = value;
}
}else if (collection[id][prop] === ""){
delete collection[id][prop];
}
return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");

Joseph
@revisualize
Nov 02 2016 01:53
@pascale-dewingaerde `myObj` is not defined.
@pascale-dewingaerde Your if conditions are all incorrect.
James Gusty
@Duruzican
Nov 02 2016 01:55
What am I missing from Nesting For Loops?
``````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.length; j++) {
product *= (arr[i][j]);
}
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);``````
Nov 02 2016 01:55
@sjames1958gm I think I need to look more into this, but I do understand that using the `?` lets jquery set the jsonp callback. I'm just confused as why we use `jsonpCallback: 'mycallback',`
Joseph
@revisualize
Nov 02 2016 01:55
@Duruzican Your second for loop needs to be evaluated.
Pascale
@pascale-dewingaerde
Nov 02 2016 01:55
@revisualize I think I don't understand the condition rules :(
Nov 02 2016 01:55
i thought that was supposed to match what you specify as the callback in your url
James Gusty
@Duruzican
Nov 02 2016 01:56
@revisualize haha thanks again
CamperBot
@camperbot
Nov 02 2016 01:56
duruzican sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2190 | @revisualize |http://www.freecodecamp.com/revisualize
Nov 02 2016 01:57
@sjames1958gm thanks again for your help! I'm sure I'll figure this out. Time for me to head out though
CamperBot
@camperbot
Nov 02 2016 01:57
adamakers sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Nov 02 2016 01:57
@pascale-dewingaerde // If prop isn't "tracks" and value isn't an empty string (""),
@pascale-dewingaerde // If prop is "tracks" and value isn't an empty string (""),
Pascale
@pascale-dewingaerde
Nov 02 2016 01:59
@revisualize ok, I think I understand better now. Thanks!
CamperBot
@camperbot
Nov 02 2016 01:59
pascale-dewingaerde sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2191 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 02 2016 02:00

@pascale-dewingaerde
Parameters are values that get passed into your function from the function call. You can use parameters like variables.
Example:

``````function hello(name) {
return "Hello " + name + ", How is your day?";
}
hello("Joseph"); // "Hello Joseph, How is your day?"``````

You can use the `name` parameter just like a variable inside of your function.

With the `updateRecords` function you get three parameters to use when you're building how your function works: `id`, `prop` & `value`

Pascale
@pascale-dewingaerde
Nov 02 2016 02:01
CamperBot
@camperbot
Nov 02 2016 02:01
pascale-dewingaerde sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: pascale-dewingaerde already gave revisualize points
Chris Johnson
@crjohn14
Nov 02 2016 02:01
Am I crazy, or is this a palindrome when only lowercase letters remain? "1 eye for of 1 eye." CodeCamp says this should return false but all my other tests work
eyeforofeye... right?
Joseph
@revisualize
Nov 02 2016 02:02
@crjohn14 but, you should be removing all of the non-alphanumeric values.. .... Ergo, keeping the alphanumeric values.
Chris Johnson
@crjohn14
Nov 02 2016 02:03
ohhh... I leave in numbers then? thanks
Joseph
@revisualize
Nov 02 2016 02:04
@crjohn14 Yes.
cbot
CamperBot
@camperbot
Nov 02 2016 02:08
you called?
Amira Moussa
@AmiraMoussa
Nov 02 2016 02:09

hey guys heres my code but for some reasons its not working

``````// Setup
var collection = {
"2548": {
"album": "Slippery When Wet",
"artist": "Bon Jovi",
"tracks": [
"Let It Rock",
"You Give Love a Bad Name"
]
},
"2468": {
"album": "1999",
"artist": "Prince",
"tracks": [
"1999",
"Little Red Corvette"
]
},
"1245": {
"artist": "Robert Palmer",
"tracks": [ ]
},
"5439": {
"album": "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
if (prop !== "tracks" && value !== ""){
return id;
//       + id.album + id.artist + id.tracks ;
}else  if (prop === "tracks" && "tracks" === ""){
var array = [];

}

return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");``````

anyone can help ??

``Record Collection``
Connor O'Shea
@foreverifilm
Nov 02 2016 02:09

How do i get playerNumber to be a number?
// Setup

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

// Only change code below this line;
playerNumber = "16";
var player = testObj[playerNumber]; // Change this Line
console.log(player); // Change this Line

Joseph
@revisualize
Nov 02 2016 02:10
Amira Moussa
@AmiraMoussa
Nov 02 2016 02:11
@revisualize thanks ill read it and try to fix my code :thumbsup:
CamperBot
@camperbot
Nov 02 2016 02:11
amiramoussa sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2192 | @revisualize |http://www.freecodecamp.com/revisualize
Walid Ashri
@walidashri
Nov 02 2016 02:13
@foreverifilm `playerNumber = "16";` this a string not number
jens3cakes
@jens3cakes
Nov 02 2016 02:18

var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
if (myObj.hasOwnProperty(checkProp)===true);{
return myObj[checkProp];
}
if (myObj.hasOwnProperty(checkProp)===false);{
}
}
// Test your code by modifying these values

Crandon
@Crandon
Nov 02 2016 02:23
var gloveBoxContents = myStorage.car["inside"].glovebox; this gives me an error that says "inside" should be best used in dot notation but im supposed to have both dot and bracket notation
Walid Ashri
@walidashri
Nov 02 2016 02:23
@Crandon is glove box one word in the myStorage declaration?
Crandon
@Crandon
Nov 02 2016 02:25
yes
jens3cakes
@jens3cakes
Nov 02 2016 02:25
@walidashri should i remove the false statement? its still not working. ARGGGGGG!!!!!
Walid Ashri
@walidashri
Nov 02 2016 02:27
@jens3cakes it's else no need for anther if
Crandon
@Crandon
Nov 02 2016 02:27
nvm i figured it out
@buharinasir
Nov 02 2016 02:28
please why this my code is not working

function truthCheck(collection, pre) {
// Create a counter to check how many are true.
var counter = 0;

// Check for each object
for (var c in collection) {
// If it has the same property or the same property value then add 1
if (collection[c].hasOwnProperty(pre) || collection[c][pre] == pre) {
counter++;
}
}

// Outside the loop, check to see if we got true for all of them and return true or false
if (counter == collection.length) {
return true;
}
else
{
return false;
}
}

truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex");

Walid Ashri
@walidashri
Nov 02 2016 02:29
@Crandon are you sure
Pascale
@pascale-dewingaerde
Nov 02 2016 02:30

I only habe one error remaining : After updateRecords(5439, "artist", "ABBA"), artist should be "ABBA". Code : // Setup
var collection = {
"2548": {
"album": "Slippery When Wet",
"artist": "Bon Jovi",
"tracks": [
"Let It Rock",
"You Give Love a Bad Name"
]
},
"2468": {
"album": "1999",
"artist": "Prince",
"tracks": [
"1999",
"Little Red Corvette"
]
},
"1245": {
"artist": "Robert Palmer",
"tracks": [ ]
},
"5439": {
"album": "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
if (collection[id][prop] !== "tracks" && value!== ""){
if (collection[id].hasOwnProperty(prop)){
collection[id][prop].push(value);
}else{
collection[id][prop] = [];
collection[id][prop].push(value);
}
}else if (collection[id][prop] == "tracks" && value!== ""){
if (collection[id].hasOwnProperty(prop)){
collection[id][prop].push(value);
}else{
collection[id][prop] = [];
collection[id][prop].push(value);
}
}else if (value === ""){
delete collection[id][prop];
}

return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");

Walid Ashri
@walidashri
Nov 02 2016 02:35
@maherbuhari how pre is going to be the property name and the value in same time?
@pascale-dewingaerde why creating array in every case?
Pascale
@pascale-dewingaerde
Nov 02 2016 02:41
@walidashri I don't know exactly. I'm on that exercise since more than 2 hours now. :(
TheFish
Nov 02 2016 02:41
Quick question; When the "Seek and Destroy" is at its reset form and I return arr;, I only get the first part of the array and not the entire array
Joseph
@revisualize
Nov 02 2016 02:41
@pascale-dewingaerde So.
TheFish
Nov 02 2016 02:42

function destroyer(arr) {
return arr;
}

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

Joseph
@revisualize
Nov 02 2016 02:42
@pascale-dewingaerde Can I ask you a side question?
Walid Ashri
@walidashri
Nov 02 2016 02:42
@pascale-dewingaerde u are in the right track just read instructions carefully you'll get it
TheFish
Nov 02 2016 02:42
it give me only [1,2,3,1,2,3]
shouldn't it return: ([1, 2, 3, 1, 2, 3],2,3)?
Walid Ashri
@walidashri
Nov 02 2016 02:43
TheFish
Nov 02 2016 02:43
why is that?
Pascale
@pascale-dewingaerde
Nov 02 2016 02:43
@walidashri Thanks, I think I will sleep and look at it tomorrow.
CamperBot
@camperbot
Nov 02 2016 02:43
pascale-dewingaerde sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Nov 02 2016 02:44
@pascale-dewingaerde can you write me an if statement?
if fName is "Joseph" and uName is @revisualize update the value of the variable `awesome` to true // only because I want to be awesome.
Then I'd ask you to write another if statement.
if prop is "tracks" ....
@pascale-dewingaerde Oh, you're leaving?
:|
:v:
TheFish
Nov 02 2016 02:45
Joseph
@revisualize
Nov 02 2016 02:46
Dennis Orsini
@dlbears
Nov 02 2016 02:46
I keep having an error thrown when i try to access the Weather API, can someone look at my pen https://codepen.io/dlbears/pen/GjVGmg
Nov 02 2016 02:46
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.
Joseph
@revisualize
Nov 02 2016 02:47

// How do you add a number (`item`) to the end of an array (`arr`)? What does this method return?
// How do you remove the first element from an array (`arr`)? What does this method return?

Nov 02 2016 02:47

function nextInLine(arr, item) {
testArr.push(item);

return arr.shift();
}
// 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));

Joseph
@revisualize
Nov 02 2016 02:47
@GhadirMira You should be adding the `item` to the end of the `arr` not the global `testArr`
TheFish
Nov 02 2016 02:47
Joseph, can you please explain? Arguments.
Joseph
@revisualize
Nov 02 2016 02:49
Parameters are the values that you expect to work with in your function.
if you create a function you can pass any number of arguments to the function.
But, if you only have a set number of parameters. You'll have to work with the arguments key word to get all of the arguments that were passed to the function.
c0d0er
@c0d0er
Nov 02 2016 02:49
@walidashri thanks
CamperBot
@camperbot
Nov 02 2016 02:49
c0d0er sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Nov 02 2016 02:50
@elad1984 An argument is a value (primitive or object) passed as input to a function.
``````function unknownNumberOfArgs () {
var args = Array.from(arguments);
var args = [...arguments];
return args;
}
unknownNumberOfArgs(1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,6,6,6,6,6,6);``````
TheFish
Nov 02 2016 02:52
so basically, if I return arr, it will only return items that are in an array []?
Joseph
@revisualize
Nov 02 2016 02:53
``````function someArguments (name) {
console.log(name);
console.log(arguments);
return "Hello " + name;
}
someArguments("Joseph", "is", "an", "awesome", "guy", "so", "he", "thinks");``````
TheFish
Nov 02 2016 02:57
Sorry. I still don't get it..
Joseph
@revisualize
Nov 02 2016 02:57
@elad1984 Did you run the code?
TheFish
Nov 02 2016 02:57
yes
it shows Hello Joseph
why isn't name = "Joseph", "is", "an", "awesome", "guy", "so", "he", "thinks"
Joseph
@revisualize
Nov 02 2016 02:58
@elad1984 Because there is only 1 parameter.
TheFish
Nov 02 2016 02:58
how does it know that name is only [0]?
Joseph
@revisualize
Nov 02 2016 02:58
hansenwang
@hansenwang1996
Nov 02 2016 03:00
Hello, could anyone tell me where did the solution on github move to? I can't find it for days.
Joseph
@revisualize
Nov 02 2016 03:01
@fakesome Wiki
hansenwang
@hansenwang1996
Nov 02 2016 03:01
TheFish
Nov 02 2016 03:01
thanks Joseph. I'll look into it.
hansenwang
@hansenwang1996
Nov 02 2016 03:02
Thanks a lot !
Joseph
@revisualize
Nov 02 2016 03:02
@elad1984 If you want to go any more advanced that that... I don't really have any answers for you.
Arya
@beingmojo
Nov 02 2016 03:03
Hi, can someone please review my code for Profile Lookup problem, It doesn't pass first three conditions.
``````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";
}
else {
return "No such contact";
}

}
// Only change code above this line
</code>
}``````
Joseph
@revisualize
Nov 02 2016 03:04
@beingmojo I can see your problem.
Arya
@beingmojo
Nov 02 2016 03:04
What is it @revisualize?
Joseph
@revisualize
Nov 02 2016 03:04
@beingmojo Can I ask you a side question?
Arya
@beingmojo
Nov 02 2016 03:04
Joseph
@revisualize
Nov 02 2016 03:04
@beingmojo 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?
Arya
@beingmojo
Nov 02 2016 03:05
When I have looked through all 200 cards
Joseph
@revisualize
Nov 02 2016 03:06
@beingmojo Great. Now let's say you had a list of contacts. When would you tell me that you didn't have a contact in your list?
Arya
@beingmojo
Nov 02 2016 03:06
Look through entire list, isn't that what I am doing
Joseph
@revisualize
Nov 02 2016 03:07
@beingmojo No.
@beingmojo Return statements halt the function.
Arya
@beingmojo
Nov 02 2016 03:08
I see.. let me try without them
brb
Joseph
@revisualize
Nov 02 2016 03:08
@beingmojo Wait.
Arya
@beingmojo
Nov 02 2016 03:08
ok
Joseph
@revisualize
Nov 02 2016 03:08
@beingmojo You just need to modify very little of your code.
Arya
@beingmojo
Nov 02 2016 03:08
ok
Joseph
@revisualize
Nov 02 2016 03:09
@beingmojo Look at how I asked you the first question.
There was a strike-through for a reason.
@beingmojo You just need to move one segment of your code around.
@beingmojo You do NOT need to remove all return statements. You just need to make some slight modifications.
Arya
@beingmojo
Nov 02 2016 03:10
ok
Joseph
@revisualize
Nov 02 2016 03:10
Arya
@beingmojo
Nov 02 2016 03:11
Is that the last return..
brb
Connor O'Shea
@foreverifilm
Nov 02 2016 03:13

I need to know how to lookup val and assign the associated string to the result variable. All I get when I run this is Frank but the rest doesn't print.
// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup= {

``````"bravo": result = "Boston",

"charlie":result = "Chicago",

"delta":result = "Denver",

"echo":result = "Easy",

"foxtrot":result = "Frank"``````

};

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

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

Joseph
@revisualize
Nov 02 2016 03:14
@foreverifilm because you don't have any code accessing the object.
@foreverifilm Also, objects should really just be key value pairs. But, you do you.
Arya
@beingmojo
Nov 02 2016 03:16
@revisualize It works however is there a any alternate way to achieve this.
``````function lookUpProfile(firstName, prop){
// Only change code below this line
var result = false;
for(var i=0; i<contacts.length; i++){
if(contacts[i].firstName==firstName)
{
if(contacts[i].hasOwnProperty(prop)) {
result = true;
return contacts[i][prop];
}
else
return "No such property";
}

}
if(result===false){
return "No such contact";
}
// Only change code above this line
}``````
Joseph
@revisualize
Nov 02 2016 03:17
@beingmojo Yeah.
Arya
@beingmojo
Nov 02 2016 03:18
how?
Joseph
@revisualize
Nov 02 2016 03:18
@beingmojo remove this:
`var result = false;`
`result = true;`
`if(result===false){`
and remove the lonely `}` that you created that pairs with `if(result===false){`
Arya
@beingmojo
Nov 02 2016 03:19
done
Joseph
@revisualize
Nov 02 2016 03:19
@beingmojo Does it still work?
Arya
@beingmojo
Nov 02 2016 03:20
holly molly it does Sir.. @revisualize thanks
CamperBot
@camperbot
Nov 02 2016 03:20
beingmojo sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2193 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 02 2016 03:20
@beingmojo Better question. Do you understand it?
Arya
@beingmojo
Nov 02 2016 03:20
Yes.. I do now
Joseph
@revisualize
Nov 02 2016 03:21
@beingmojo Is there any way that I could have explained it better without giving away the answer?
Arya
@beingmojo
Nov 02 2016 03:21
@revisualize I see like how you made me think around everything..
no Sir.. you are an amazing teacher.. you just earned a follower @revisualize
Joseph
@revisualize
Nov 02 2016 03:23
@beingmojo Do you want to see how I solved the challenge?
Not that my way is the correct way. It's just a way.
Arya
@beingmojo
Nov 02 2016 03:28
ofcourse
perfect
@revisualize thanks for sharing
CamperBot
@camperbot
Nov 02 2016 03:31
beingmojo sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: beingmojo already gave revisualize points
Joseph
@revisualize
Nov 02 2016 03:32
@beingmojo I don't use the Ternary operator all that often. But, this looked like a perfect situation.
Arya
@beingmojo
Nov 02 2016 03:32
I understand the inline ternary however never used it.. seems like I should give it a shot
yes ofcourse the code looks beautiful
Joseph
@revisualize
Nov 02 2016 03:33
I don't know about all that.
Arya
@beingmojo
Nov 02 2016 03:34
thanks again @revisualize
CamperBot
@camperbot
Nov 02 2016 03:34
beingmojo sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: beingmojo already gave revisualize points
Connor O'Shea
@foreverifilm
Nov 02 2016 03:42

How do I get checkObj("gift") to return "pony "and checkObj("pet") to return "Kitten".

function checkObj(checkProp) {
var myObj = {
pet: "kitten",
bed: "sleigh"
};
checkObj.hasOwnProperty("pet");
checkObj.hasOwnProperty("house");

}

// Test your code by modifying these values

Nov 02 2016 03:43
testGreaterOrEqual(21) should return "20 or Over"

function testGreaterOrEqual(val) {
if (val >= 100) { // Change this line
return "20 or Over";
}

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

return "9 or Under";
}

// Change this value to test
testGreaterOrEqual(21);

how do i do that?
Joseph
@revisualize
Nov 02 2016 03:44
@GhadirMira `if (val >= 100) { // Change this line`
Nov 02 2016 03:44
to what @revisualize
Joseph
@revisualize
Nov 02 2016 03:45
20
Nov 02 2016 03:45
thanks!
Joseph
@revisualize
Nov 02 2016 03:45
@GhadirMira I do it for the brownies.
Nov 02 2016 03:45
i feel stuiped :smile:
Joseph
@revisualize
Nov 02 2016 03:46
Nov 02 2016 03:46
lol yea
Krystin Villeneuve
@krystin987
Nov 02 2016 03:51
can someone give me a clue on challenge 191? nothing I try works.
Annu Nirmal
@annunirmal
Nov 02 2016 03:54
topic:portfolio
i want every time i come to skill section it animates again and again. can anyone help me out with this
http://codepen.io/nirmalannu/full/amgaqE/
@ydeepk
Nov 02 2016 03:58
@annunirmal nice Portfolio :sparkles: :clap:
Joseph
@revisualize
Nov 02 2016 04:02
@krystin987 Name?
Amira Moussa
@AmiraMoussa
Nov 02 2016 04:02

hey guys please I need help in Profile Lookup

```

``````
//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
if (firstName === contacts[0].firstName && prop === contacts[0].firstName[prop]){
return contacts.firstName[prop];

}else if (firstName !== contacts[0].firstName){
return "No such contact";
} else if (prop !== contacts[0].firstName[prop]){
return "No such property";
}
// Only change code above this line
}
// Change these values to test your function
lookUpProfile("Akira", "likes");``````
Krystin Villeneuve
@krystin987
Nov 02 2016 04:02
i figured it out, actually ^_^
Joseph
@revisualize
Nov 02 2016 04:03
@AmiraMoussa Ummm... You have some issues. You're only checking against the first array element?
Amira Moussa
@AmiraMoussa
Nov 02 2016 04:05
@revisualize yeah it's an array of 1 ellement with many objects
Joseph
@revisualize
Nov 02 2016 04:05
@AmiraMoussa No.
@AmiraMoussa It's an array with 4 elements and each of those elements is an object.
@AmiraMoussa Look
``var contacts = [ { ... }  ,  { ... }  ,   { ... }  ,  { ... } ];``
Dennis Orsini
@dlbears
Nov 02 2016 04:07

why does this happen with codepen:

http://i.imgur.com/GWH3Rn2.png

Joseph
@revisualize
Nov 02 2016 04:08
@dlbears Are you doing an HTTPS call to your API or an HTTP call?
Dennis Orsini
@dlbears
Nov 02 2016 04:09
@revisualize if i prefix the api request with http or https the connection drops
Amira Moussa
@AmiraMoussa
Nov 02 2016 04:09
@revisualize oh sorry 4 objects right ...
Joseph
@revisualize
Nov 02 2016 04:12
@AmiraMoussa So, I think you need to change the way that you're doing the lesson. Because you have 4 array elements. Not just 1.
Amira Moussa
@AmiraMoussa
Nov 02 2016 04:12
@revisualize maybe a for loop can solve the problem ?
ghanzo
@ghanzo
Nov 02 2016 04:16
can anyone give me the answer for "stand in line" lesson 174
175
Joseph
@revisualize
Nov 02 2016 04:18
@ghanzo Have you solved the challenge?
ghanzo
@ghanzo
Nov 02 2016 04:18
no
quite stuck
i know it has something to do with .push and .shift
what confuses me most of all though is the json after it
i dont really get how the test is working
Joseph
@revisualize
Nov 02 2016 04:19
@ghanzo I don't really give away answers. But, I'm more than willing to help you work through the challenge if you haven't solved it.
Dennis Orsini
@dlbears
Nov 02 2016 04:20
@revisualize you have any idea with the error might be /:
ghanzo
@ghanzo
Nov 02 2016 04:21
ok
so arr is the queue
is testArr the same as just arr
why are testArr and arr different
Joseph
@revisualize
Nov 02 2016 04:23
@ghanzo Because `arr` is the parameter. You're tests aren't just passing `testArr` to the function as an argument.
@ghanzo
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
Only one of the test cases uses `testArr` as the argument to the function.
ghanzo
@ghanzo
Nov 02 2016 04:24
so do i need to add testArr in the code?
Joseph
@revisualize
Nov 02 2016 04:24
@ghanzo No.
ghanzo
@ghanzo
Nov 02 2016 04:24
then what does testArr have to do with the code at all
confusing
Joseph
@revisualize
Nov 02 2016 04:25
@ghanzo That's just it. When you're working in industry you'll be dropped into a code base that is already developed. You need to learn how to navigate the code base and only work with what you're tasked to resolve.
ghanzo
@ghanzo
Nov 02 2016 04:26
Joseph
@revisualize
Nov 02 2016 04:26
@ghanzo I added those code comments. Yes. But, there are actual comments to the gist that you should look over as well.
Jeff
@horusofoz
Nov 02 2016 04:28
Looking for help with Escape Sequences in Strings exercise from JS section
I've created my string as
var myStr = "FirstLine\n\SecondLine\\nThirdline";
Joseph
@revisualize
Nov 02 2016 04:29
@horusofoz You're not escaping the carriage-return and you didn't spell ThirdLine correctly.
Jeff
@horusofoz
Nov 02 2016 04:30
@revisualize Where on the carriage-return is the slash missing?
Johnny
@JohnnyBizzel
Nov 02 2016 04:30
@horusofoz for slash you need `\\`
Joseph
@revisualize
Nov 02 2016 04:30
@horusofoz What carriage return .. You don't have it. You have a newline escaped where there should be a carriage-return.
Jeff
@horusofoz
Nov 02 2016 04:30
Ok trying that now
Matt Tankersley
@txtanks
Nov 02 2016 04:31
hello all - who is here to help?
Jeff
@horusofoz
Nov 02 2016 04:31
@revisualize Thanks mate.
CamperBot
@camperbot
Nov 02 2016 04:31
horusofoz sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2194 | @revisualize |http://www.freecodecamp.com/revisualize
Johnny
@JohnnyBizzel
Nov 02 2016 04:31
@horusofoz Reference to escape chars are all over the internet. You need to learn these! https://en.wikipedia.org/wiki/Escape_character#JavaScript
ghanzo
@ghanzo
Nov 02 2016 04:32

function nextInLine(arr, item) {
// Add the number to the end of the array,
item.push(arr);
// then remove the first element of array.
return arr.shift();
// The nextInLine function should

``// then return the element that was removed. // 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));

so this is what im thinking, what needs to be changed

Johnny
@JohnnyBizzel
Nov 02 2016 04:32
Joseph
@revisualize
Nov 02 2016 04:32
@ghanzo `item` isn't an array. `item` is a number. You can't `.push()` to a number.
Jeff
@horusofoz
Nov 02 2016 04:32
@JohnnyBizzel I have some idea of how escape characters work just was using a second newline in place of carriage-return by accident. Also had erred in the casing of ThirdLine
Johnny
@JohnnyBizzel
Nov 02 2016 04:33
@ghanzo Did you google JS push()?
Jeff
@horusofoz
Nov 02 2016 04:33
But thank you still for the reference @JohnnyBizzel
CamperBot
@camperbot
Nov 02 2016 04:33
horusofoz sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
Johnny
@JohnnyBizzel
Nov 02 2016 04:33
@horusofoz :+1: It catches many people out that challenge.
@ghanzo Here you go: http://www.w3schools.com/jsref/jsref_push.asp
As you can see the push takes and item and adds it to an array [someArray].push([someItem]); like so
ghanzo
@ghanzo
Nov 02 2016 04:35
ok so it needs to be arr.push(item)
Johnny
@JohnnyBizzel
Nov 02 2016 04:35
@ghanzo :+1:
Joseph
@revisualize
Nov 02 2016 04:35
@ghanzo Does that solve the challenge?
ghanzo
@ghanzo
Nov 02 2016 04:36
yeah it does
Johnny
@JohnnyBizzel
Nov 02 2016 04:36
@ghanzo Thanks! :D Have a brownie
CamperBot
@camperbot
Nov 02 2016 04:36
johnnybizzel sends brownie points to @ghanzo :sparkles: :thumbsup: :sparkles:
ghanzo
@ghanzo
Nov 02 2016 04:36
thanks @revisualize , thanks @JohnnyBizzel
CamperBot
@camperbot
Nov 02 2016 04:36
ghanzo sends brownie points to @revisualize and @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 2195 | @revisualize |http://www.freecodecamp.com/revisualize
Dennis Orsini
@dlbears
Nov 02 2016 04:41
fixed the issue, the api cal ended up being: "https://crossorigin.me/http://api.openweathermap.org/..."
Joseph
@revisualize
Nov 02 2016 05:26
@dlbears Grats
Solomon B
@ssbothwell
Nov 02 2016 05:40
hi guys. i'm having trouble with the Smallest Common Multiple exercise. Ive gotten to the point where I am generating an array of arrays of the multiples of all the numbers in the desired range. At the same time i figured out how to compare two arrays of multiples to find the lowest common multiple. I'm not sure how to compare more then two sets of multiples.
Paul Hoskinson
@plhosk
Nov 02 2016 05:43
@ssbothwell that is a tough one.
i can't remember how i did it exactly
Paul Hoskinson
@plhosk
Nov 02 2016 05:43
LOL
Solomon B
@ssbothwell
Nov 02 2016 05:43
yeah this might be the hardest one yet
Paul Hoskinson
@plhosk
Nov 02 2016 05:43
it contains all your code so others can see it
Solomon B
@ssbothwell
Nov 02 2016 05:43
for me
yeah
Paul Hoskinson
@plhosk
Nov 02 2016 05:43
i'll try to describe my method
Dennis Orsini
@dlbears
Nov 02 2016 05:43
why not just embed it in the chat?
Paul Hoskinson
@plhosk
Nov 02 2016 05:43
Johnny
@JohnnyBizzel
Nov 02 2016 05:43
@ssbothwell Have you tried pair programming for this challenge? It is quite complicated
'''
Solomon B
@ssbothwell
Nov 02 2016 05:44
ive never pair programmed :/
dont really know how that works online
dennis:

function smallestCommons(arr) {

// Sort numbers lowest to highest
arr.sort();

// Create array of all numbers lowest
// to highest
range = [];
for ( i = arr[0]; i <= arr[1]; i++) {
range.push(i);
}

// Invoke multiples array
multiples = [];

// For each number in range, iterate
// through multiples and load into multiples
// array
range.forEach(function(element) {
subArray = [];
for ( j = 1; j <= range[0] range[range.length -1]; j++ ) {
subArray.push(element
j);
}
multiples.push(subArray);
});

// loop through 1st and last multiples lists and return
// first matching elements
for ( k = 0; k < multiples[0].length; k++ ) {
for (l = 0; l < multiples[multiples.length -1].length; l++ ) {
if ( multiples[0][k] == multiples[multiples.length -1][l] ) {
return multiples[multiples.length -1][l];
}
}

}

//return multiples;

}

smallestCommons([5,3]);

sorry this is so spammy
Paul Hoskinson
@plhosk
Nov 02 2016 05:44
@ssbothwell you can't just use arr.sort(); to sort numbers
Dennis Orsini
@dlbears
Nov 02 2016 05:44
you can use slack and https://screenhero.com/
Paul Hoskinson
@plhosk
Nov 02 2016 05:44
it sorts it alphabetically.
Johnny
@JohnnyBizzel
Nov 02 2016 05:45
@ssbothwell There is a Let's pair room or you could make a forum post.
Paul Hoskinson
@plhosk
Nov 02 2016 05:45
so 20 would come before 3
Solomon B
@ssbothwell
Nov 02 2016 05:45
ooh i didnt realize that
well thats a problem
Paul Hoskinson
@plhosk
Nov 02 2016 05:45
you need to use a callback function
arr.sort(function (a, b) { return b-a} );
actually
return a-b;
Solomon B
@ssbothwell
Nov 02 2016 05:46
got it
yes i remember that from an earlier exercise now
Johnny
@JohnnyBizzel
Nov 02 2016 05:47
@ssbothwell Is this valid? `for ( j = 1; j <= range[0] range[range.length -1]; j++ ) {`
Solomon B
@ssbothwell
Nov 02 2016 05:47
thats a sort of temporary thing i did
to pull the first and last elements from the array
so i can test with the outer two numbers of the range
before i try to compare the full range
Paul Hoskinson
@plhosk
Nov 02 2016 05:48
my soltion probably isn't the most efficient
it doesn't work unless i put //noprotect at the top
it stops due to infinite loop LOL
Solomon B
@ssbothwell
Nov 02 2016 05:48
uh oh
lol
Paul Hoskinson
@plhosk
Nov 02 2016 05:48
but it works
Johnny
@JohnnyBizzel
Nov 02 2016 05:49
@ssbothwell My solution was complicated. I can't really follow it looking back at it.
Solomon B
@ssbothwell
Nov 02 2016 05:49
im thinking theres probably some way to use filter
to get only matching numbers across all the sets of multiples
then pick the lowest number
does that sound like a good route to investigate?
Paul Hoskinson
@plhosk
Nov 02 2016 05:51
so heres what i did basically
first sorted the array
next i made a new array containing each number from arr[0] to arr[1]
next i computed the largest multiple by multiplying each number in the new array
Solomon B
@ssbothwell
Nov 02 2016 05:52
multiplied them all together?
Samiullah Khan
@technbuzz
Nov 02 2016 05:52
Hey I have question, should I ask or wait for ongoing discussion?
Paul Hoskinson
@plhosk
Nov 02 2016 05:52
ya
then i do a loop from 1 to that number
for loop
btw this is prob a terrible method lOL
Solomon B
@ssbothwell
Nov 02 2016 05:53
thats gonna be a big loop
Paul Hoskinson
@plhosk
Nov 02 2016 05:53
then theres a nested for loop
from the first number in "new array" to the last number
Solomon B
@ssbothwell
Nov 02 2016 05:55
ok
Paul Hoskinson
@plhosk
Nov 02 2016 05:55
if the index of the first loop Modulus index of 2nd loop does not equal zero, break the inner for loop
else if the index of the inner loop is the largest number in arr, return the index of outer for loop
there it is LOL
i guess it's a "brute force" method
just testing every number from 1 to the largets possible.
to see if it's a common multiple
Solomon B
@ssbothwell
Nov 02 2016 05:57
yeah
well, i'd like to find a less intensive solution but i may fall back on copying you
thanks @plhosk @JohnnyBizzel
CamperBot
@camperbot
Nov 02 2016 05:58
ssbothwell sends brownie points to @plhosk and @johnnybizzel :sparkles: :thumbsup: :sparkles:
Johnny
@JohnnyBizzel
Nov 02 2016 05:58
@ssbothwell :+1: I would encourage you to try pair programming at some point. It's hard to go through the whole course on your own.
Paul Hoskinson
@plhosk
Nov 02 2016 05:59
Solomon B
@ssbothwell
Nov 02 2016 05:59
@JohnnyBizzel yeah i want to do it. i was actually planning to go to a freecodecamp study group tonight IRL but got caught up at work.
ive almost finished the frontend certificate on my own tho!
Paul Hoskinson
@plhosk
Nov 02 2016 06:00
i managed to do all of front end on my own also
but i have some previous experience in python
Johnny
@JohnnyBizzel
Nov 02 2016 06:01
@ssbothwell Nice one!
KellaTe
@KellaTe
Nov 02 2016 06:01
HI .my friends . i have a problem.
when i use + operator
Paul Hoskinson
@plhosk
Nov 02 2016 06:03
Solomon B
@ssbothwell
Nov 02 2016 06:03
@plhosk i have some python experience as well. I think i like it more then javascript :worried:
Paul Hoskinson
@plhosk
Nov 02 2016 06:03
you need to put it inside one of the quotes
@ssbothwell python is definitely cleaner and more cohesive as a language.
but the new ES6 features of javascript are quite nice
Solomon B
@ssbothwell
Nov 02 2016 06:04
yeah i heard that
Paul Hoskinson
@plhosk
Nov 02 2016 06:04
bringing it much closer
KellaTe
@KellaTe
Nov 02 2016 06:04
@plhosk thanks
CamperBot
@camperbot
Nov 02 2016 06:04
kellate sends brownie points to @plhosk :sparkles: :thumbsup: :sparkles:
Solomon B
@ssbothwell
Nov 02 2016 06:04
im coming around to javascript
i havent done much programming since 2009/2010 and im really surprised how much javascript has eclipsed everything else
for webdev
Paul Hoskinson
@plhosk
Nov 02 2016 06:05
JS is the only supported client side language so theres no competition really
for server-side people still use python, php, java..
Solomon B
@ssbothwell
Nov 02 2016 06:06
it seems like javascript is moving onto the server
Paul Hoskinson
@plhosk
Nov 02 2016 06:06
but also JS is practical on server
with Node.js
Solomon B
@ssbothwell
Nov 02 2016 06:06
yeah
i'm curious to start the node.js exercises and see what its all about
Paul Hoskinson
@plhosk
Nov 02 2016 06:07
once you finish front-end
Solomon B
@ssbothwell
Nov 02 2016 06:07
but i wanna finish the front end cert before i move forward
Paul Hoskinson
@plhosk
Nov 02 2016 06:07
there's the data visualizaiton
whcih is pretty tough!
Solomon B
@ssbothwell
Nov 02 2016 06:07
is it all react?
Paul Hoskinson
@plhosk
Nov 02 2016 06:07
because there are no exercies
React, SCSS, D3
React is the most interesting part
Solomon B
@ssbothwell
Nov 02 2016 06:08
i was thinking about learning vuejs
but i should wait and try react first
its so tempting to jump all over the place
Paul Hoskinson
@plhosk
Nov 02 2016 06:09
I did the first exercise in React then went and learned Redux too
since those are commonly used together.
here is my best achievement so far
Samiullah Khan
@technbuzz
Nov 02 2016 06:10
@plhosk I am stuck at algorithm says "Sum All Numbers in a Range". I need some hints. For instance how Math.min.max are beneficial here?
Solomon B
@ssbothwell
Nov 02 2016 06:11
awesome! i love conways game of life
Joseph
@revisualize
Nov 02 2016 06:11
@technbuzz Yes.
Jit
@kunwarjit
Nov 02 2016 06:11
Hello All
I am trying to solve the golf code javascript challenge and it appears that there is a bug
Joseph
@revisualize
Nov 02 2016 06:11
@technbuzz Well, it is `Math.min` or `Math.max`
@kunwarjit There is.. What's your code?!
Jit
@kunwarjit
Nov 02 2016 06:12

function golfScore(par, strokes) {
// Only change code below this line

if (strokes == 1)
{
return "Hole-in-One!";
}
else if (strokes <= par - 2)
{
return "Eagle";
}
else if (strokes == par - 1)
{
return "Birdie";
}
else if (strokes == par)
{
return "Par";
}
else if (strokes == par + 1)
{
return "Bogey";
}
else if (strokes == par + 2)
{
return "Double Bogey";
}
else if (strokes >= par + 3)
{
return "Go Home!";
}
// Only change code above this line
}

Joseph
@revisualize
Nov 02 2016 06:12
@kunwarjit `"Hole-in-One!";` is not the same as `"Hole-in-one!";`
Jit
@kunwarjit
Nov 02 2016 06:12
if I put in golfScore (1, 1); the console writes in the correct answer

# facepalm

Joseph
@revisualize
Nov 02 2016 06:13
No bug.
Samiullah Khan
@technbuzz
Nov 02 2016 06:13
Joseph
@revisualize
Nov 02 2016 06:13
@kunwarjit Did you solve it?
Jit
@kunwarjit
Nov 02 2016 06:13
yes
it was a spelling mistake
thanks guys
Joseph
@revisualize
Nov 02 2016 06:14
missed out on another brownie.
Jit
@kunwarjit
Nov 02 2016 06:14
@revisualize you solved my issue
Samiullah Khan
@technbuzz
Nov 02 2016 06:18
Hello all, need some help with the first challenge under Intermediate Algorithm Scripting
Chris Cullen
@123xylem
Nov 02 2016 06:18
Does Anyone know about UNITY Developing??
Im trying to add light but it just wont WORK
[IMG]http://i65.tinypic.com/157nng5.png[/IMG]
Markus Kiili
@Masd925
Nov 02 2016 06:18
@technbuzz What is the challenge name and what is the problem with it?
Joseph
@revisualize
Nov 02 2016 06:18
Sum all numbers in range
Samiullah Khan
@technbuzz
Nov 02 2016 06:19
yes @revisualize
just give me some hints @revisualize
Joseph
@revisualize
Nov 02 2016 06:19
@technbuzz `Math.min` and `Math.max` and a `for` loop?
Samiullah Khan
@technbuzz
Nov 02 2016 06:20
@Masd925 The name is Sum all numbers in range
Markus Kiili
@Masd925
Nov 02 2016 06:20
@technbuzz You can find the smaller and larger number by using Math.max and Math.min
Samiullah Khan
@technbuzz
Nov 02 2016 06:20
But Math.min won't work on arrays.
Markus Kiili
@Masd925
Nov 02 2016 06:20
Use the array elements.
Joseph
@revisualize
Nov 02 2016 06:21
@technbuzz But, you know that your array always has 2 elements. So...
Samiullah Khan
@technbuzz
Nov 02 2016 06:22
so @revisualize you saying that I could access them as Math.min(arr[0],arr[1]) ?
Joseph
@revisualize
Nov 02 2016 06:22
This message was deleted
@technbuzz Does that work? If so.. Why not?
Samiullah Khan
@technbuzz
Nov 02 2016 06:23
Let me check and report back to you @revisualize @Masd925
Joseph
@revisualize
Nov 02 2016 06:24
@Masd925 I was just looking over my solution for that challenge. I didn't realize that I solved it seven different ways.
@technbuzz You still need to do something else to do the addition part.
Samiullah Khan
@technbuzz
Nov 02 2016 06:25
yes @Masd925 using Reduce
Joseph
@revisualize
Nov 02 2016 06:26
@technbuzz Using reduce for that challenge was by far the most complicated.
Samiullah Khan
@technbuzz
Nov 02 2016 06:26
okay @Masd925 I am thinking to not use Math.min or Math.max and sort them array items than go for forloop, what do you say. Is that one of your way to solve this challenge?
Markus Kiili
@Masd925
Nov 02 2016 06:27
@technbuzz Sort should be avoided if you don't really use the sorted array. Math.max/min is better.
Joseph
@revisualize
Nov 02 2016 06:27
I agree.
Samiullah Khan
@technbuzz
Nov 02 2016 06:27
Can you elaborate on that @Masd925 ?
Markus Kiili
@Masd925
Nov 02 2016 06:28
Here it doesn't matter too much but avoiding sorting in general is a good idea, because sorting is a slow process.
Samiullah Khan
@technbuzz
Nov 02 2016 06:38
Thanks @revisualize @Masd925 I've solved it.
CamperBot
@camperbot
Nov 02 2016 06:38
technbuzz sends brownie points to @revisualize and @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2822 | @masd925 |http://www.freecodecamp.com/masd925
:star2: 2201 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 02 2016 06:39
@technbuzz How did you do it?
Samiullah Khan
@technbuzz
Nov 02 2016 06:40
Found the max and min and then with for loop went through all the values b/w lower boundary and upper boundary and added to the result variable.
Pinedab
@pinedab
Nov 02 2016 06:41
Hey can someone help me with the Stand in line exerise on fcc - im having a hard time returning the first element, prior to shift/splice. Ive come up with two solutions but one meets 3/4 tasks [i use shift] and the other meets the missing task[I use splice() and save/return the first element in a var].
ghanzo
@ghanzo
Nov 02 2016 06:42
is there a bug with this
?

// Setup
function testEqual(val) {
if (val == 12);{
return "Equal";
}
return "Not Equal";
}

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

when tested i dont get not equal
i get equal
Samiullah Khan
@technbuzz
Nov 02 2016 06:43
you are missing else
ghanzo
@ghanzo
Nov 02 2016 06:43
doesnt say so in the description
so is it like this?

// Setup
function testEqual(val) {
if (val == 12);{
return "Equal";
}
else { return "Not Equal";
}}

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

Samiullah Khan
@technbuzz
Nov 02 2016 06:43
yes
Markus Kiili
@Masd925
Nov 02 2016 06:43
@ghanzo Else is optional there. Remove the semicolon after first if `12);{`
Coy Sanders
@coymeetsworld
Nov 02 2016 06:44
no @ghanzo
also theres 2 ending brackets
ghanzo
@ghanzo
Nov 02 2016 06:44
that did it
@Masd925 thanks
CamperBot
@camperbot
Nov 02 2016 06:44
ghanzo sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2823 | @masd925 |http://www.freecodecamp.com/masd925
ghanzo
@ghanzo
Nov 02 2016 06:45
thanks @technbuzz
CamperBot
@camperbot
Nov 02 2016 06:45
ghanzo sends brownie points to @technbuzz :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Nov 02 2016 06:45
@ghanzo Do you understand why that was causing your code to not work?
ghanzo
@ghanzo
Nov 02 2016 06:45
it was a syntax error
Joseph
@revisualize
Nov 02 2016 06:45
Yeah, the `;` is a statement terminator.
ghanzo
@ghanzo
Nov 02 2016 06:45
i thought i needed a semicolon after (val)
statement terminator
i like that
Samiullah Khan
@technbuzz
Nov 02 2016 06:46
Code is not executed further once function find the return statement @ghanzo
Bcrea
@Bcrea
Nov 02 2016 06:46
can i have a little help with this challenge? `Seek and Destroy`
``````function destroyer(arr) {
var args = Array.prototype.slice.call(arguments);
var result = [];
for (var i=0; i<arr.length; i++) {
if (arr[i] < args[1]) {
result.push(arr[i]);
}
}
return result;
}

destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3);``````
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:46
``````
// Setup
var a;
var b = 2;

// Only change code below this line

var a = 7;
var b = 7;``````
how do I assign a to b?
Joseph
@revisualize
Nov 02 2016 06:47
@ryanjvandyke Can I ask a side question?
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:47
of course
Joseph
@revisualize
Nov 02 2016 06:47
@ryanjvandyke How do you assign 5 to a variable `num`?
@ryanjvandyke How do you assign 22 to a variable `num`?
Markus Kiili
@Masd925
Nov 02 2016 06:47
@Bcrea You also need to loop or iterate through the arguments array.
Pinedab
@pinedab
Nov 02 2016 06:47

how can i get this func w arguments nextInLine([], 1) to return 1? This is the Stand in Line Exercise in FCC basic javascript `function nextInLine(arr, item) {

var first = arr[0];
arr.splice(0, 1);
arr.push(item);
return first; // Change this line
}

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

Bcrea
@Bcrea
Nov 02 2016 06:48
@Masd925 will do that :+1:
Markus Kiili
@Masd925
Nov 02 2016 06:48
@Bcrea There is also a handy array method for checking if the arr element is found on args.
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:49
@revisualize var = 22
myNum = var
I think?
Joseph
@revisualize
Nov 02 2016 06:49
@ryanjvandyke Not really.
@ryanjvandyke But, that's the idea you should be using for your lesson.
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:50
not sure I understand
Joseph
@revisualize
Nov 02 2016 06:50
@ryanjvandyke If the variable `a` is equal to 7. And you use the variable `a` and assign it to `b` ... Whatever `a` is gets assigned to `b`.
@ryanjvandyke How do you assign 5 to a variable num?
``var num = 5;``
Bcrea
@Bcrea
Nov 02 2016 06:51
you just did
Joseph
@revisualize
Nov 02 2016 06:51
@ryanjvandyke How do you assign 22 to a variable num?
``var num = 22;``
@ryanjvandyke Then I follow the same line of questioning.
@ryanjvandyke How do you assign `a` to a variable `b`?
Bcrea
@Bcrea
Nov 02 2016 06:51
`=` << means assignment
Samiullah Khan
@technbuzz
Nov 02 2016 06:52
@pinedab there is array method to push and element to the end of array;
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:52
var a = var b?
Joseph
@revisualize
Nov 02 2016 06:53
@ryanjvandyke Why do would someone do the first two in one order but the third question is done in reverse?
supermario0315
@supermario0315
Nov 02 2016 06:53

var myVar = 87;

// Only change code below this line
myVar = myVar + 1;

How do I use the ++ operator?

Joseph
@revisualize
Nov 02 2016 06:53
@supermario0315
``````var num = 5;
num = num + 1; // 6
num += 1; // 7
num++; // 8``````
Pinedab
@pinedab
Nov 02 2016 06:53
@technbuzz - isn't it push()?, i played around with the order, but that didn't fix it
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:53
I'm so lost lol I'm sorry
Joseph
@revisualize
Nov 02 2016 06:53
@ryanjvandyke You're doing it backwards.
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:54
I hear you but I still don't quite understand
Joseph
@revisualize
Nov 02 2016 06:54
@ryanjvandyke Also, you don't use `var` on the right side of the assignment operator.
Pinedab
@pinedab
Nov 02 2016 06:54
@supermario0315 the ++operator replaces the need to repeat code, so myVar = myVar+1; is the same as myVar++;
Joseph
@revisualize
Nov 02 2016 06:55

@ryanjvandyke

``````var x = 13;
var y = x;``````

What is `y`?

Samiullah Khan
@technbuzz
Nov 02 2016 06:55
yes @pinedab but you need to provide element needs to be added
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:55
13?
Joseph
@revisualize
Nov 02 2016 06:55
@ryanjvandyke Yes.
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:55
alright I get that
i just don't get how to assign x to y
Joseph
@revisualize
Nov 02 2016 06:56

@ryanjvandyke

``````var a = 7;
var b = a;``````

How do I assign a to b?

Like that.
What is `b`?

Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:56
7
Joseph
@revisualize
Nov 02 2016 06:56
@ryanjvandyke That is how you assign `a` to `b`.
supermario0315
@supermario0315
Nov 02 2016 06:57

@pinedab So how do I do this?

var myVar = 87;

// Only change code below this line
myVar = myVar ++;

myVar has to equal 88

Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:57
oh goodness I see
Markus Kiili
@Masd925
Nov 02 2016 06:57
@ryanjvandyke The assignment operator `=` evaluates whatever is at the right hand side and assigns that value to the variable on the left hand side. You have to know what these operators actually do.
Joseph
@revisualize
Nov 02 2016 06:57
@supermario0315
``````var num = 5;
num = num + 1; // 6
num += 1; // 7
num++; // 8``````
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 06:57
thanks! @revisualize and @Masd925
CamperBot
@camperbot
Nov 02 2016 06:57
ryanjvandyke sends brownie points to @revisualize and @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2824 | @masd925 |http://www.freecodecamp.com/masd925
:star2: 2202 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 02 2016 06:58
@supermario0315 Do you see how I get to 8? There is no assignment `=` operator.
supermario0315
@supermario0315
Nov 02 2016 06:59
@revisualize OH I get it now
@revisualize Thanks
CamperBot
@camperbot
Nov 02 2016 06:59
supermario0315 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2203 | @revisualize |http://www.freecodecamp.com/revisualize
Pinedab
@pinedab
Nov 02 2016 07:00
@supermario0315 The point of the ++ operator is to add one to the variable its after and to reduce repetition. So "myVar++;" does the same as "myVar = myVar + 1;" Make sense?
Bcrea
@Bcrea
Nov 02 2016 07:01
@Masd925 i'm now here :smile: which is basically the same where i was before
``````function destroyer(arr) {
var args = Array.prototype.slice.call(arguments);
return val < args[1];
});
}

destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3);``````
Markus Kiili
@Masd925
Nov 02 2016 07:01
@Bcrea You need to loop or iterate over args inside the filter callback.
@Bcrea You should return true if val is not found on args and false if it is.
Joseph
@revisualize
Nov 02 2016 07:02
:zzz: ... :sailboat: ... :zzz: ... :sailboat: :sunrise: ... :zzz: ... :sailboat: :tropical_fish: :sunrise: ... :zzz: ... :sailboat: :tropical_fish: :dolphin: :whale2: :sunrise: ... :zzz: :v:
Markus Kiili
@Masd925
Nov 02 2016 07:02
@Bcrea Filter keeps those arr elements that return true when passed into the callback function.
Philipp Scholz
@philipp32
Nov 02 2016 07:04
Hey guys, I am having a problem with the JS challenge Stand in Line.
Joseph
@revisualize
Nov 02 2016 07:04
``````[true, true, false, false, true, false, false, true, true].filter(function (x) { return x });
[23,1,6,12,17,3,2,5,19,86,87].filter(function (x) {return x % 2 });``````
Philipp Scholz
@philipp32
Nov 02 2016 07:05
``````function nextInLine(arr, item) {
arr= "Philipp";
item = 2;
var myArray = arr + item;
var removed = myArray.shift();

return myArray;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(arr, item));
console.log("After: " + JSON.stringify(testArr));``````
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.
Joseph
@revisualize
Nov 02 2016 07:05
@philipp32 You're not adding item to the end of the arr correctly.
@philipp32 You're not returning the element that was removed.
and on that note...
:v:
Markus Kiili
@Masd925
Nov 02 2016 07:07
@philipp32 Inside the function you should only use `arr` and `item`. They are function parameters that hold the passed array and number (function input).
Ankit Kumar
@ak-its-simple
Nov 02 2016 07:09
Hello Geeks
Joseph
@revisualize
Nov 02 2016 07:09
Nerd.
Pinedab
@pinedab
Nov 02 2016 07:09
@Masd925 Im having trouble on the same problem as @philipp32 but I can't get it to return 1 when the parameters are ([], 1). Help? It passes the rest of the tests.
`var jo = arr.shift();`
`arr.push(item);`
`return jo;`
Joseph
@revisualize
Nov 02 2016 07:10
@pinedab You could try that link that I posted.
Markus Kiili
@Masd925
Nov 02 2016 07:10
@pinedab Post the code you have.
almuallem
@almuallem
Nov 02 2016 07:10
S7eve
@S7eve
Nov 02 2016 07:11
does anyone familiar on how to use jquery datepicker() here? I got some problem with it atm :(
Philipp Scholz
@philipp32
Nov 02 2016 07:11
@pinedab You need to use .shift()
Pinedab
@pinedab
Nov 02 2016 07:11
@revisualize I did, thanks. I changed it up but still doesnt solve it.
`var jo = arr.shift();`
`arr.push(item);`
`return jo;`
CamperBot
@camperbot
Nov 02 2016 07:11
pinedab sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2204 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 02 2016 07:12
@pinedab You're out of order.
@pinedab You should push before you shift.

@pinedab
Add the number to the end of the array,

then remove the first element of array.
The nextInLine function should
then return the element that was removed.

S7eve
@S7eve
Nov 02 2016 07:13
does anyone know about any forum that can help me with jquery datepicker() ? ty
Joseph
@revisualize
Nov 02 2016 07:14
@pinedab You're code is removing before adding.
Pinedab
@pinedab
Nov 02 2016 07:14
Thank you all!!
Sorin Ruse
@sorinr
Nov 02 2016 07:15
@S7eve what is the problem with jq datepicker?
Puspak
@Puspak64
Nov 02 2016 07:17

function updateRecords(id, prop, value) {
if(prop !== "tracks" && value !== "")
{
collection[id][prop]= value;
}
else if (prop == "tracks" && value !== "") {
if (!collection.hasOwnProperty("tracks")) {
collection[id][prop] = [];
}
collection[id][prop].push(value);
} else {
delete collection[id][prop];
}
console.table(collection);
return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");

i am stuck in record collection problem.

The test case : After updateRecords(2468, "tracks", "Free"), tracks should have "1999" as the first element.

Joseph
@revisualize
Nov 02 2016 07:19
@Puspak64 `if (!collection.hasOwnProperty("tracks")) {` // there is an error here.
Philipp Scholz
@philipp32
Nov 02 2016 07:20
@Masd925 @revisualize
`````` function nextInLine(arr, item) {
arr.push(item);
return arr.shift();
}
// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(arr, item));
console.log("After: " + JSON.stringify(testArr));``````
Joseph
@revisualize
Nov 02 2016 07:20
@philipp32 Congrats.
Philipp Scholz
@philipp32
Nov 02 2016 07:20
still say that arr is not defined.
Joseph
@revisualize
Nov 02 2016 07:21
This message was deleted
`console.log(nextInLine(arr, item));`
`arr` is not defined in the global scope.
Philipp Scholz
@philipp32
Nov 02 2016 07:22
@revisualize @Masd925 thank you
CamperBot
@camperbot
Nov 02 2016 07:22
philipp32 sends brownie points to @revisualize and @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2205 | @revisualize |http://www.freecodecamp.com/revisualize
:star2: 2825 | @masd925 |http://www.freecodecamp.com/masd925
Philipp Scholz
@philipp32
Nov 02 2016 07:22
I passed it. :)
Puspak
@Puspak64
Nov 02 2016 07:23
@revisualize what is the error?
Joseph
@revisualize
Nov 02 2016 07:23
@Puspak64 What?
Fernando Sugianto
@fyzz100
Nov 02 2016 07:24
sorry for disturbing you guys again,anyone can teach me how to pass Record Collection?
Puspak
@Puspak64
Nov 02 2016 07:25
@revisualize if (!collection.hasOwnProperty("tracks")) { //u said there is an error in it
Joseph
@revisualize
Nov 02 2016 07:25
@Puspak64 You're not accessing the object in the collection correctly. Hint: use an `[id]` ?
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:28
@fyzz100 what's causing the headache? :smile:
Prateek Gogia
@reeversedev
Nov 02 2016 07:29
Anyone done with Escape Sequences in strings challenge?
Fernando Sugianto
@fyzz100
Nov 02 2016 07:31
@Lumexralph Sometimes,I really cannot understand to instruction.Like what should I type,etc.
For this case,I utterly cannot comprehend what they want me to do Q.Q
Puspak
@Puspak64
Nov 02 2016 07:31

@revisualize thanks !!!

Problem solved :smile:

CamperBot
@camperbot
Nov 02 2016 07:31
puspak64 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2206 | @revisualize |http://www.freecodecamp.com/revisualize
Ilian Iliev
@zaken
Nov 02 2016 07:32
@Vijayanandkrishnan
``````if (count > 0){
return count + " Bet";
}
else {
return count + " Hold";
}``````
Prateek Gogia
@reeversedev
Nov 02 2016 07:32
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:33
@fyzz100 what helps at times is to write out what you are to do in the challenge, from there you can have a good start and even able to ask questions people will be able to answer
without confusing eachother
@fyzz100 can you paste the instructions?
@reeversedev how can we be of help?
Prateek Gogia
@reeversedev
Nov 02 2016 07:35
Anyone done with Escape Sequences in strings challenge?
Ilian Iliev
@zaken
Nov 02 2016 07:37
@reeversedev Yes.
Fernando Sugianto
@fyzz100
Nov 02 2016 07:38
@Lumexralph

Write a function which takes an album's id (like 2548), a property prop (like "artist" or "tracks"), and a value (like "Addicted to Love") to modify the data in this collection.

If prop isn't "tracks" and value isn't empty (""), update or set the value for that record album's property.

Your function must always return the entire collection object.

There are several rules for handling incomplete data:

If prop is "tracks" but the album doesn't have a "tracks" property, create an empty array before adding the new value to the album's corresponding property.

If prop is "tracks" and value isn't empty (""), push the value onto the end of the album's existing tracks array.

If value is empty (""), delete the given prop property from the album.

@Lumexralph I cant write out what i need to do because I dont understand the question sometimes(as english is not my first lang)
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:40
@fyzz100 oh I can understand
Nov 02 2016 07:40
Hello everyone. I'm just about finished with my Weather App, and I'm having trouble with my XMLHttpRequest. Its getting to readyState-1 then ....nothing. Any pointers? Thanks in advance. http://codepen.io/adampinsky/pen/yOYLge?editors=0011
Prateek Gogia
@reeversedev
Nov 02 2016 07:42
Ilian Iliev
@zaken
Nov 02 2016 07:42
@fyzz100
1. The function requires 3 inputs -> id (ex. 2548) , prop (ex. "album") , value ("Slippery When Wet")
2. If the value you enter is blank, function should delete the whole property.
3. If prop == "tracks", push the value to it.
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:42
@fyzz100 you're to write a function that take 3 parameters.....id(of the album) a property of the collection and value of that property
``````function(id, prop, val) {
}``````
@fyzz100 then you have to use branching ...conditional statements if and else to check for the tests, can you try that?
Ilian Iliev
@zaken
Nov 02 2016 07:44
@reeversedev What exactly is the problem you face about it?
Fernando Sugianto
@fyzz100
Nov 02 2016 07:44

@dzift @Lumexralph
I wrote this just now,based on how much I understand
function updateRecords(id, prop, value) {

if (prop !== "tracks") {
return collection[id][prop];
} else {
return collection[id][prop][value];
}
}

Prateek Gogia
@reeversedev
Nov 02 2016 07:44
I am not able to use new line character.
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:45
@fyzz100 you're to return the collection, so that's a wrong way firstly....you're to add the values to the collection
Ilian Iliev
@zaken
Nov 02 2016 07:46
abbas ashraf mughal
@abbasashraf
Nov 02 2016 07:47
how i create a diamond pattern pls help
Ilian Iliev
@zaken
Nov 02 2016 07:48
@fyzz100 Right now you are returning (stopping) the function if prop is not "tracks"
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:48
@fyzz100 which means if prop is not track && value is not empty, you'll have to add that value to collection using the accessing an object way
Prateek Gogia
@reeversedev
Nov 02 2016 07:50
var myStr = "FirstLine\n \SecondLine\r\ThirdLine";
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:50
@fyzz100 don't return anything in your conditional statements just add it to collection
Ilian Iliev
@zaken
Nov 02 2016 07:52
@Lumexralph Try writing down all the checks that need to be made and think about in what order should they be written
@reeversedev don't forget to escape the backslashes "\"
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:53
it's after your conditions are done then you return the collection(which is the whole object at the top of the code in your challenge)
@dzift let me see what I can bring up
Ilian Iliev
@zaken
Nov 02 2016 07:54
@Lumexralph sorry I meant to reply to @fyzz100 :D
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:54
@dzift lol..it's all good man, we trying to help a brother :smile:
Fernando Sugianto
@fyzz100
Nov 02 2016 07:55

@dzift @Lumexralph
function updateRecords(id, prop, value) {
if (prop == "tracks") {
return collection[id][prop][value];
} else if (prop == "artist") {
return collection[id][prop];
} else {
return collection[id][prop];
}

}

wrong approach?
Prateek Gogia
@reeversedev
Nov 02 2016 07:55
@dzift var myStr = "FirstLine\n \ \SecondLine\ \r\ThirdLine";
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:56
@fyzz100 just like @dzift said write out the first condition and let's solve that together, we'll break it down bits by bits
@fyzz100 not totally wrong approach but you're not to return anything in your conditional statements just update collection
Fernando Sugianto
@fyzz100
Nov 02 2016 07:58
@Lumexralph Actually i did not understand any bit of the instruction... XD
Ilian Iliev
@zaken
Nov 02 2016 07:58
@reeversedev not sure if it's a typo but check third line
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:58
@fyzz100 can you do us a favour to make our job easier? write the first condition to check from the challenge
@fyzz100 okay
@fyzz100 If prop isn't "tracks" and value isn't empty (""), update or set the value for that record album's property.
Prateek Gogia
@reeversedev
Nov 02 2016 07:59
@dzift var myStr = "FirstLine\n\bSecondLine\b\r\ThirdLine";
Ogundele Olumide
@Lumexralph
Nov 02 2016 07:59
@fyzz100 right?
Ilian Iliev
@zaken
Nov 02 2016 08:00
@fyzz100 let's start with checking if "value" is empty and deleting the "prop" if it is.
KellaTe
@KellaTe
Nov 02 2016 08:00
hi.my friends.when i practice about basic javascript,i have a problem.
Ogundele Olumide
@Lumexralph
Nov 02 2016 08:01
@dzift am thinking we should work with the conditions to help out or understand for future challenge, what do you think?
KellaTe
@KellaTe
Nov 02 2016 08:01
Ilian Iliev
@zaken
Nov 02 2016 08:01
@reeversedev FirstLine(newline)(backslash)SecondLine(backslash)(newline)ThirdLine
KellaTe
@KellaTe
Nov 02 2016 08:01
Ogundele Olumide
@Lumexralph
Nov 02 2016 08:02
@fyzz100 working with the first condition
If prop isn't "tracks" and value isn't empty (""), update or set the value for that record album's property.
``````if (value !== "" && prop !== "tracks") {
collection[id][prop] = value;
}``````
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 08:03
ok i must be tired here, but i cant seem to read this properly lol. Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.
Ilian Iliev
@zaken
Nov 02 2016 08:04
@ryanjvandyke divide 11 by 3 and return the remainder
Prateek Gogia
@reeversedev
Nov 02 2016 08:04
@dzift Can you tell me the code?
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 08:04
right but how does that look?
Ogundele Olumide
@Lumexralph
Nov 02 2016 08:04
@ryanjvandyke `remainder = 11 % 3`
Prateek Gogia
@reeversedev
Nov 02 2016 08:04
I am really fed up of this now
Fernando Sugianto
@fyzz100
Nov 02 2016 08:04
@Lumexralph
didnt undertend the 'update or set the value for that record album's property.' part
but I wont give up...let me give it another shot
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 08:05
var remainder = 11 % 3 so like this?
its still not running correctly
Ilian Iliev
@zaken
Nov 02 2016 08:05
Ogundele Olumide
@Lumexralph
Nov 02 2016 08:05
@fyzz100 did you understand the code I pasted
Fernando Sugianto
@fyzz100
Nov 02 2016 08:06
@Lumexralph no sir
didnt understand the
collection[id][prop] = value;
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 08:09
I understand the question here but I'm not understanding how to write the code: Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.
Johnny
@JohnnyBizzel
Nov 02 2016 08:09
@reeversedev Perhaps you are not Iron man after all ;)
Prateek Gogia
@reeversedev
Nov 02 2016 08:10
@JohnnyBizzel I'll prove it.
Johnny
@JohnnyBizzel
Nov 02 2016 08:11
@reeversedev backslash is escaped `\\`
Codemzy
@codemzy
Nov 02 2016 08:12
@ryanjvandyke I'm guessing you need to set the variable `remainder` to equal the expression of the remainder of 11 divided by 3 (use the remainder operator)
gudboey
@gudboey
Nov 02 2016 08:12
hi wvweyonw
am here again
Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.
i dont understand this question
Codemzy
@codemzy
Nov 02 2016 08:13
@ryanjvandyke here's some examples of the remainder operator for further reading... https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder_()
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 08:13
yes, but every way i try writing it out it doesn't work @codemzy
Codemzy
@codemzy
Nov 02 2016 08:13
@ryanjvandyke how are you writing it?
gudboey
@gudboey
Nov 02 2016 08:13
the questions under "Using Objects for Lookups"
Ogundele Olumide
@Lumexralph
Nov 02 2016 08:13
@ryanjvandyke just as i posted use the var before and let's see what it brings
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 08:14
var remainder; 11 % 3
gudboey
@gudboey
Nov 02 2016 08:14
anyone to help me
Ilian Iliev
@zaken
Nov 02 2016 08:14
@ryanjvandyke
``var remainder = 11 % 3``
Ogundele Olumide
@Lumexralph
Nov 02 2016 08:14
@ryanjvandyke var x = 11%3, x should be 2
Codemzy
@codemzy
Nov 02 2016 08:14
@ryanjvandyke thats no setting remainder to equal your expression, you need to use `=` to assign that expression to remainder
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 08:15
its not working when i run it
var remainder = 11%3
that's what i have written
Ilian Iliev
@zaken
Nov 02 2016 08:15
gudboey
@gudboey
Nov 02 2016 08:15
heloo!!!!!!!!!!!!!!!!!!
Ilian Iliev
@zaken
Nov 02 2016 08:16
@ryanjvandyke
``var remainder = 11 % 3;``
gudboey
@gudboey
Nov 02 2016 08:16
Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 08:16
and that's what i was missing the whole time haha, thanks guys! @codemzy @dzift @Lumexralph
CamperBot
@camperbot
Nov 02 2016 08:16
ryanjvandyke sends brownie points to @codemzy and @dzift and @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1353 | @codemzy |http://www.freecodecamp.com/codemzy
gudboey
@gudboey
Nov 02 2016 08:16
i dont understand this question
Fernando Sugianto
@fyzz100
Nov 02 2016 08:17

@Lumexralph @dzift
function updateRecords(id, prop, value) {
if(prop !== "tracks") {
if (value !== "") {
collection[id][prop] = value;
}
} if (prop == "tracks" && collection[prop] !== "tracks") {
collection[id].push ("tracks");
collection[id][prop] = "tracks";

} if (prop == "tracks" && value !== "") {
collection[id][prop].push (value);
} if (value === "") {
delete collection[prop];
}

return collection;

gudboey
@gudboey
Nov 02 2016 08:17
no one will mind me
Codemzy
@codemzy
Nov 02 2016 08:17
@ryanjvandyke :thumbsup: that's code for you! it's usually some ; missing somewhere that messes up your whole application lol
Ryan VanDyke
@ryanjvandyke
Nov 02 2016 08:17
its the worst haha
but i love it at the same time
Ilian Iliev
@zaken
Nov 02 2016 08:19
@fyzz hint: solution is 3 lines
gudboey
@gudboey
Nov 02 2016 08:19
hello
Ilian Iliev
@zaken
Nov 02 2016 08:21
@fyzz100 Think about it this way: you should start with the IF that filters out the most possible cases. For example here I think it's best to start with a simple IF that checks if value is empty or not, and delete the prop if it is empty
Fernando Sugianto
@fyzz100
Nov 02 2016 08:24
@dzift my head hurts so much now ><
Ilian Iliev
@zaken
Nov 02 2016 08:26
@fyzz100 take a break, go for a walk
Ogundele Olumide
@Lumexralph
Nov 02 2016 08:26
@fyzz100 why don't we do it step-wise?
@fyzz100 (1) first condition If prop isn't "tracks" and value isn't empty (""), update or set the value for that record album's property.
Prateek Gogia
@reeversedev
Nov 02 2016 08:28
@JohnnyBizzel The problem is,I don
The problem is I don't know the meaning of escaping here.
Ogundele Olumide
@Lumexralph
Nov 02 2016 08:28
that means our function has 3 parameters right? @fyzz100
Eloisa Santos
@loisasantos
Nov 02 2016 08:29
I need help please... I don't get it.
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.
Fernando Sugianto
@fyzz100
Nov 02 2016 08:29
<