These are chat archives for FreeCodeCamp/HelpJavaScript

22nd
Jun 2016
Moisés Man
@moigithub
Jun 22 2016 00:02

not linear.. its more quadratic..cuz inner loop (indexof/lastindexof) run each time for each outside loop (i think )
soo u have something like

for (
  for(

(1 for = linear)
2 nested = quadratic
(correct me if im wrong ) :D

Jonathan Mitchell
@Vanhealen
Jun 22 2016 00:03
yeah that makes sense..
Moisés Man
@moigithub
Jun 22 2016 00:03

if u have

for( 10 iterations here
    for( another 10 iterations here...

u will have 100 iterations in total
10^2 <-- quadratic

Jeremy Mauzy
@jmauzy
Jun 22 2016 00:04
@darsparx Start your loop at monthNumber = 0. Zero months have passed when you run the first calculations.
darsparx
@darsparx
Jun 22 2016 00:05
@jmauzy nope...logged that in and it still isn't right, now it says it's too many iterations XD
Stephen James
@sjames1958gm
Jun 22 2016 00:06
@darsparx Did you adjust your ending value from <= to < when you start at 0?
@jmauzy btw, which challenge
darsparx
@darsparx
Jun 22 2016 00:07
@sjames1958gm well this is the issue though "The 4th time through, you should cut the numSheep by 4 (divide it by 4), and log the amount of sheep that were removed. You may need to do some math to calculate how many sheep were removed. You should log the message Removing 192 sheep from the population."
with @jmauzy 's change it changes to "It looks like you're logging There will be ... too many times. We only want the number of sheep logged once for each month."
Stephen James
@sjames1958gm
Jun 22 2016 00:07
I have 192 - removed after month 3
darsparx
@darsparx
Jun 22 2016 00:08
yeah but it's supposed to hit at month 4 :-\ which is weird
Stephen James
@sjames1958gm
Jun 22 2016 00:08
@darsparx Is this a FCC challenge?
darsparx
@darsparx
Jun 22 2016 00:09
no >> been half switching back and forth between FCC and code school >>
Jeremy Mauzy
@jmauzy
Jun 22 2016 00:09
@sjames1958gm looks like it's for this
Jonathan Mitchell
@Vanhealen
Jun 22 2016 00:10
thanks
@moigithub thanks
CamperBot
@camperbot
Jun 22 2016 00:10
vanhealen sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1490 | @moigithub |http://www.freecodecamp.com/moigithub
darsparx
@darsparx
Jun 22 2016 00:10
was about to post that....I figured it would be a lot simpler than it appears to be XD apparently not >_> and I was flying through them before this...
I always seem to stumble at these stupid loops no matter where it's on
Milorad Kubatović
@mlrdk
Jun 22 2016 00:27
Guys can anyone help me with the Make Object Properties Private?
I am stuck at the begining i have no clue what to do!

var Bike = function() {

// Only change code below this line.
var gear;
this.getGear = function(){
return gear;
};
this.setGear = function(){
return Bike.getGear;
};
};

What should i add or remove here?
Diego Mayer
@Chrono79
Jun 22 2016 00:31
@mlrdk return Bike.getGear; <- don't return in setGear
also, you should actually set gear, use a param in that method and change gear value
Milorad Kubatović
@mlrdk
Jun 22 2016 00:35
Thanks @Chrono79 but i've figure it out myself, the problem was that that I didn't know what gear means :S
CamperBot
@camperbot
Jun 22 2016 00:35
mlrdk sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1256 | @chrono79 |http://www.freecodecamp.com/chrono79
Michael Karpinski
@karpimpski
Jun 22 2016 00:36
hey guys, i haven't done JS in forever and i'm not sure what i'm doing wrong.
setTimeout(function(){ 
        time();
    }, 1000);
this code just executes time() once
Milorad Kubatović
@mlrdk
Jun 22 2016 00:38
try changing to 2000 and see what happends
and also google how does JS view time/s
Michael Karpinski
@karpimpski
Jun 22 2016 00:38
it's in milliseconds
and that doesn't change anything
newBorn
@nafiskarim
Jun 22 2016 00:39
Hello all!! kinda new here, trying to finish all of the chalanges and get better with everyone :)
Norvin Burrus
@ndburrus
Jun 22 2016 00:40
@nafiskarim Welcome aboard! Glad to see you here! :+1:
newBorn
@nafiskarim
Jun 22 2016 00:41
@ndburrus thank you :)
CamperBot
@camperbot
Jun 22 2016 00:41
nafiskarim sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 665 | @ndburrus |http://www.freecodecamp.com/ndburrus
Milorad Kubatović
@mlrdk
Jun 22 2016 00:41
@karpimpski I really don't see why it should return time() more than once :S
Michael Karpinski
@karpimpski
Jun 22 2016 00:42
@mlrdk oh wait should this go inside of a loop? like i said, i haven't done js in months so i'm very rusty
newBorn
@nafiskarim
Jun 22 2016 00:42
@/all Is there anyone can suggest some tool/library to serve my problem here ?
Norvin Burrus
@ndburrus
Jun 22 2016 00:43
@nafiskarim what are you working on?
Milorad Kubatović
@mlrdk
Jun 22 2016 00:43
@karpimpski yes add a simple for(var i = 0 ; i < times_you_want_your_loop_to_go; i++){
your code;}
newBorn
@nafiskarim
Jun 22 2016 00:43
Problem : if I have an api that i will collect some data from, and i want to show the data in a graphical way on a web page
Milorad Kubatović
@mlrdk
Jun 22 2016 00:43
@nafiskarim What kind of data? Spreadsheats?
Michael Karpinski
@karpimpski
Jun 22 2016 00:43
@mlrdk yeah, i know how to make a for loop :P i did all the front-end stuff and worked on js for a while, i'm embarrassed that i couldn't figure that out
newBorn
@nafiskarim
Jun 22 2016 00:44
it might be, I am not entirly sure about that right now. But does it matter?
Norvin Burrus
@ndburrus
Jun 22 2016 00:44
@mlrdk gear
noun
1.
Machinery.
a part, as a disk, wheel, or section of a shaft, having cut teeth of such form, size, and spacing that they mesh with teeth in another part to transmit or receive force and motion.
an assembly of such parts.
one of several possible arrangements of such parts in a mechanism, as an automobile transmission, for affording different relations of torque and speed between the driving and the driven machinery, or for permitting the driven machinery to run in either direction:
first gear; reverse gear.
a mechanism or group of parts performing one function or serving one purpose in a complex machine:
newBorn
@nafiskarim
Jun 22 2016 00:44
@mlrdk ?
Milorad Kubatović
@mlrdk
Jun 22 2016 00:45
@nafiskarim it does mather what kind of data you want to show.
Michael Karpinski
@karpimpski
Jun 22 2016 00:45
var currentMinute = 25;
var currentSecond = 0;

function time(){
    var currentTime = "";
    currentSecond > 0 ? currentsecond -= 1 : currentSecond = 59; currentMinute -= 1;
    currentSecond == 0 ? currentTime = currentMinute.toString() + ":00" : currentTime = currentMinute.toString() + ":" + currentSecond.toString();

    $("#time").html(currentTime);
}

for(var t = currentMinute * 60 + currentSecond; t >= 0; t--){
    setTimeout(function(){ 
    time();
    }, 50);
}
Milorad Kubatović
@mlrdk
Jun 22 2016 00:45
@nafiskarim and it also matters which API you are using
Michael Karpinski
@karpimpski
Jun 22 2016 00:45
here's my full code, it still only runs once
Milorad Kubatović
@mlrdk
Jun 22 2016 00:46
@karpimpski you need a loop inside the setTimeout function
newBorn
@nafiskarim
Jun 22 2016 00:46
@mlrdk ok . that i am not entirely sure right now. But lets say data that says about traffic on a web page or subscription number in relation to visit , someting like that
Milorad Kubatović
@mlrdk
Jun 22 2016 00:47
@nafiskarim and what kind of site are you planing to have it shown on?
@nafiskarim interactive? Or just plain static one?
Michael Karpinski
@karpimpski
Jun 22 2016 00:47
i'm sorry, you must think i'm so dumb.
var currentMinute = 25;
var currentSecond = 0;

function time(){
    var currentTime = "";
    currentSecond > 0 ? currentsecond -= 1 : currentSecond = 59; currentMinute -= 1;
    currentSecond == 0 ? currentTime = currentMinute.toString() + ":00" : currentTime = currentMinute.toString() + ":" + currentSecond.toString();

    $("#time").html(currentTime);
}


setTimeout(function(){ 
    for(var t = currentMinute * 60 + currentSecond; t >= 0; t--){
        time();
    }
}, 50);
newBorn
@nafiskarim
Jun 22 2016 00:49
@mlrdk website might be interactive, but let’s say the page that will show the data will also be interactive in hiding/showing options, or let’s say it wont have any option besides showing the data graphically
Milorad Kubatović
@mlrdk
Jun 22 2016 00:49
@karpimpski it's ok my friend, that's the beauty of coding you always have to remember the old boring stuff
Michael Karpinski
@karpimpski
Jun 22 2016 00:49
@mlrdk that still isn't working. does this look right to you?
Milorad Kubatović
@mlrdk
Jun 22 2016 00:49
@karpimpski wait a seond please
Michael Karpinski
@karpimpski
Jun 22 2016 00:50
sure, no problem. sorry
Milorad Kubatović
@mlrdk
Jun 22 2016 00:50
@karpimpski honestly try puting this in the for loop : for(var i = 0;i<5;i++)
just to see if anything changes
:D
Michael Karpinski
@karpimpski
Jun 22 2016 00:50
in the same place I have my current loop?
Milorad Kubatović
@mlrdk
Jun 22 2016 00:50
@nafiskarim I think the API will have a way of just showing the data
@karpimpski yes!
@karpimpski my code should run it 5 times.
yoni chanowitz
@yonichanowitz
Jun 22 2016 00:51
help random quote machine
CamperBot
@camperbot
Jun 22 2016 00:51
no wiki entry for: random quote machine
Michael Karpinski
@karpimpski
Jun 22 2016 00:51
yeah i see, but it still only runs once. let me just check out my old timer's code to see how i did my settimeout there
newBorn
@nafiskarim
Jun 22 2016 00:52
@mlrdk i guess i will have a spreadsheet or json object from the api. and now i should visually/graphically present it on a webpage somehow
Michael Karpinski
@karpimpski
Jun 22 2016 00:53
oh, i used a really simple setTimeout in there! i forgot there was this convenient thing
setTimeout(time, 50);
still doesn't fix my problem though
Milorad Kubatović
@mlrdk
Jun 22 2016 00:53
@nafiskarim there is no guessing in science. I will gladly help you when you find out what you will be getting. But sorry I just can't do it right now...
@karpimpski wait we will fix it!
Nathan Torquato
@TorquatoNathan
Jun 22 2016 00:53
Hey guys.. is anyone at Escape Sequences in Strings class?
Milorad Kubatović
@mlrdk
Jun 22 2016 00:54
@karpimpski you just want to escape code
Nathan Torquato
@TorquatoNathan
Jun 22 2016 00:54
I just couldn't do it
Milorad Kubatović
@mlrdk
Jun 22 2016 00:54
@TorquatoNathan where did you stuck show us some code
Nathan Torquato
@TorquatoNathan
Jun 22 2016 00:54
backslash doesn't show
just a sec
Milorad Kubatović
@mlrdk
Jun 22 2016 00:54
@karpimpski you just want to make a timeout at every number of saconds
@TorquatoNathan oh yeah a really dumb one
Michael Karpinski
@karpimpski
Jun 22 2016 00:54
@mlrdk how would i implement that? i'm not 100% sure what you mean
newBorn
@nafiskarim
Jun 22 2016 00:55
@mlrdk thanks :) as i said , those are data related to traffic to a particullar website . Does this info help?
CamperBot
@camperbot
Jun 22 2016 00:55
nafiskarim sends brownie points to @mlrdk :sparkles: :thumbsup: :sparkles:
:cookie: 235 | @mlrdk |http://www.freecodecamp.com/mlrdk
Nathan Torquato
@TorquatoNathan
Jun 22 2016 00:55
"Here is a backslash: \. \n \t\t Here is a new line with two tabs."
it doesn't work
@mlrdk what???
Tony Johnson
@tnyjhnsn
Jun 22 2016 00:57
@TorquatoNathan a backslash needs to escape itself… \
Milorad Kubatović
@mlrdk
Jun 22 2016 00:57
@TorquatoNathan yeah the instruction is dumb...
Tony Johnson
@tnyjhnsn
Jun 22 2016 00:57
\\
will this work..\\
luvly !!!
bitgrower
@bitgrower
Jun 22 2016 00:58
so ... let's take backslash ... backslash is known as an "escape" character ... to use the LITERAL backslash, you have to escape it with another backslash -
:)
Milorad Kubatović
@mlrdk
Jun 22 2016 00:58
@tony-tosp : just write "\ \n \t"
bitgrower
@bitgrower
Jun 22 2016 00:58
you got it!!! Awesome sauce!
Milorad Kubatović
@mlrdk
Jun 22 2016 00:58
@karpimpski what do you want to make?
Michael Karpinski
@karpimpski
Jun 22 2016 00:58
@mlrdk i'm re-doing my pomodoro timer, but i want to use smarter code and better css
bitgrower
@bitgrower
Jun 22 2016 00:58
@mlrdk well, not quite ... he needs to use \ ... to escape the backslash
Tony Johnson
@tnyjhnsn
Jun 22 2016 00:58
@mlrdk thanks
CamperBot
@camperbot
Jun 22 2016 00:58
tony-tosp sends brownie points to @mlrdk :sparkles: :thumbsup: :sparkles:
:cookie: 236 | @mlrdk |http://www.freecodecamp.com/mlrdk
Milorad Kubatović
@mlrdk
Jun 22 2016 00:59
@bitgrower yeah my bad
@bitgrower forgot one slash :D
thanks @bitgrower
CamperBot
@camperbot
Jun 22 2016 00:59
mlrdk sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star2: 1109 | @bitgrower |http://www.freecodecamp.com/bitgrower
Michael Karpinski
@karpimpski
Jun 22 2016 00:59
ooh, i called my setinterval within my function. let me see if that works here
bitgrower
@bitgrower
Jun 22 2016 00:59
I figured as much ... heh ... as we know ... it's the little s**t that, frustratingly, matters ...
Michael Karpinski
@karpimpski
Jun 22 2016 01:00
nope, still only does it once
bitgrower
@bitgrower
Jun 22 2016 01:00
I just didin't want to confuse @tony-tosp
Milorad Kubatović
@mlrdk
Jun 22 2016 01:00
@bitgrower yeah :( but I also think that a few of the string and array chalenges are really bad writen here on FCC
@bitgrower the instructions should have been better, and more to the point IMO!
bitgrower
@bitgrower
Jun 22 2016 01:00
I agree ... like the mad libs one, and this one ...
Milorad Kubatović
@mlrdk
Jun 22 2016 01:01
@bitgrower agreed
@karpimpski Sorry I really don't know how to help you...
herowalking
@herowalking
Jun 22 2016 01:02
Hello everyone
Milorad Kubatović
@mlrdk
Jun 22 2016 01:02
hello
welcome!
herowalking
@herowalking
Jun 22 2016 01:02
Thanks
It's 9:02 AM here
Milorad Kubatović
@mlrdk
Jun 22 2016 01:03
lol
3AM HERE :D
Michael Karpinski
@karpimpski
Jun 22 2016 01:03
@mlrdk it's no problem, i'm really not sure why this won't work when i'm using it the exact same way of implementing it. thank you so much for your help though, i really appreciate it
CamperBot
@camperbot
Jun 22 2016 01:03
karpimpski sends brownie points to @mlrdk :sparkles: :thumbsup: :sparkles:
:cookie: 237 | @mlrdk |http://www.freecodecamp.com/mlrdk
Michael Karpinski
@karpimpski
Jun 22 2016 01:03
@herowalking China? @mlrdk UK?
herowalking
@herowalking
Jun 22 2016 01:03
@mlrdk so late
China
Milorad Kubatović
@mlrdk
Jun 22 2016 01:03
@karpimpski no problem! Please message me here privately when you solve it, it bugs me not to know the answer!
Michael Karpinski
@karpimpski
Jun 22 2016 01:03
@mlrdk actually no, central europe?
Milorad Kubatović
@mlrdk
Jun 22 2016 01:04
@karpimpski and @herowalking Serbia :D
@herowalking Your President was here during the last few days xD
Michael Karpinski
@karpimpski
Jun 22 2016 01:04
man i was close!
herowalking
@herowalking
Jun 22 2016 01:04
Yes
Milorad Kubatović
@mlrdk
Jun 22 2016 01:04
@karpimpski You from?
herowalking
@herowalking
Jun 22 2016 01:04
Mr. Xi is in your country
A242
@A242
Jun 22 2016 01:04
Having a heard time with "Profile Lookup" ugh
Milorad Kubatović
@mlrdk
Jun 22 2016 01:05
@A242 tell us where are you stuck, and we will try to help!
Michael Karpinski
@karpimpski
Jun 22 2016 01:06
@mlrdk i'm from the United States, it's 9:05 pm here
herowalking
@herowalking
Jun 22 2016 01:07
US vs Argentina now?
A242
@A242
Jun 22 2016 01:07
@mlrdk Alright, well I'm not sure if I should use an if else function or if I should use a while loop
herowalking
@herowalking
Jun 22 2016 01:08
Copa América Centenario
Michael Karpinski
@karpimpski
Jun 22 2016 01:08
@A242 if you're iterating through an object, which i think it what you do in that, you should use a for loop
is*
Stephen James
@sjames1958gm
Jun 22 2016 01:08
@herowalking USA v. Argentina
Milorad Kubatović
@mlrdk
Jun 22 2016 01:09
@A242 look at this: function lookUpProfile(firstName, prop) {
for (i = 0; i < contacts.length; i++) {
if (contacts[i].firstName === firstName) {
if (contacts[i].hasOwnProperty(prop)) {
return contacts[i][prop];
}
this is half the job done
you just need to add something more after that to fulfill the task!
A242
@A242
Jun 22 2016 01:11
@mlrdk Thanks a lot, but what exactly is iterating through an object?
CamperBot
@camperbot
Jun 22 2016 01:11
a242 sends brownie points to @mlrdk :sparkles: :thumbsup: :sparkles:
:cookie: 238 | @mlrdk |http://www.freecodecamp.com/mlrdk
A242
@A242
Jun 22 2016 01:11
Nvm I guess I can google it
Milorad Kubatović
@mlrdk
Jun 22 2016 01:12
@A242 going through each one
Like listing through objects
A242
@A242
Jun 22 2016 01:13
@mlrdk Ahh, alright thanks again for your help I really appreciate it
CamperBot
@camperbot
Jun 22 2016 01:13
a242 sends brownie points to @mlrdk :sparkles: :thumbsup: :sparkles:
:warning: a242 already gave mlrdk points
Stephen James
@sjames1958gm
Jun 22 2016 01:13
@A242 In this case you are iterating through an array containing objects.
@A242 Think of the array as a stack of business cards and you are searching for a specific first name and specific property.
Milorad Kubatović
@mlrdk
Jun 22 2016 01:14
@A242 no problem
A242
@A242
Jun 22 2016 01:15
@sjames1958gm Makes sense :+1:
huynhmatt
@huynhmatt
Jun 22 2016 01:27
hello world, anyone mind helping with my homework?
CamperBot
@camperbot
Jun 22 2016 01:27

welcome to FreeCodeCamp @huynhmatt!

Michael Karpinski
@karpimpski
Jun 22 2016 01:27
@huynhmatt i'll try!
huynhmatt
@huynhmatt
Jun 22 2016 01:28
awesome! so what i'm trying to do is remove the punctuation from a strong
"It was the best of times, it was the worst of times,
it was the age of wisdom, it was the age of foolishness,
it was the epoch of belief, it was the epoch of incredulity,
it was the season of Light, it was the season of Darkness,
it was the spring of hope, it was the winter of despair,
we had everything before us, we had nothing before us,
we were all going direct to Heaven, we were all going direct the other way --
in short, the period was so far like the present period,
that some of its noisiest authorities insisted on its being received,
for good or for evil, in the superlative degree of comparison only."
that is the string
i want to replace the periods, commas, and hypens, so i used replace(/[.,-]/g,"");
then when i count the words, i only get 116. i need to have 119
i count the words using split()
var beg_array=beg.split(" ");
wilsonkaya
@wilsonkaya
Jun 22 2016 01:30
Hi could somebody help me with "using objectives for lookups"
huynhmatt
@huynhmatt
Jun 22 2016 01:30
the reason i can't get 119 is because it spaces out some of the words
for examples
",it,was,the,age,of,foolishness it,was,"
between foolishness and it, there is no comma. could you tell me what i did wrong?
this occurs 3 times
Michael Karpinski
@karpimpski
Jun 22 2016 01:31
@huynhmatt 1 sec
wilsonkaya
@wilsonkaya
Jun 22 2016 01:31
I can't understand instructions
Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.
Michael Karpinski
@karpimpski
Jun 22 2016 01:31
for future regex use regexr, it's awesome! @huynhmatt
huynhmatt
@huynhmatt
Jun 22 2016 01:31
i'll look into it! this is for homework and i don't think we covered that topic yet
Michael Karpinski
@karpimpski
Jun 22 2016 01:32
@huynhmatt regexr is just something to visually test your regexs! it's very helpful
it's a website, not a js method or anything
huynhmatt
@huynhmatt
Jun 22 2016 01:32
oh okay, sorry about that haha. new to coding :)
Michael Karpinski
@karpimpski
Jun 22 2016 01:33
and you're taking on regexes this early? brave :P
huynhmatt
@huynhmatt
Jun 22 2016 01:33
it's a summer course so it's moving fairly fast haha. i've taking Java before
i don't remember anyone about regexes in that course
Michael Karpinski
@karpimpski
Jun 22 2016 01:33
just try replace(/,/g,"");
that should work
huynhmatt
@huynhmatt
Jun 22 2016 01:33
okay one sec
wait, i have to replace commas periods and hyphens
that's why i did brackets
Michael Karpinski
@karpimpski
Jun 22 2016 01:34
`/[,.-]/'
/[,.-]/
you have to use an escape character for the period
wilsonkaya
@wilsonkaya
Jun 22 2016 01:35
Hi can somebody help me please
Michael Karpinski
@karpimpski
Jun 22 2016 01:35
i mean to type: /[,\.-]/
so this should work: replace(/[\.,-]/g,"");
the reason yours didn't work is because . is used to represent a character. if you want it to represent a period, you need to do \.
DJ Pelland
@dna113p
Jun 22 2016 01:36
@wilsonkaya Just ask your question, no need to ask to ask.
Michael Karpinski
@karpimpski
Jun 22 2016 01:36
@huynhmatt
Norvin Burrus
@ndburrus
Jun 22 2016 01:36
@huynhmatt Welcome aboard! Glad to see you here! :sparkles:
huynhmatt
@huynhmatt
Jun 22 2016 01:36
@karpimpski nope, didn't work. still getting 116 characters.
@ndburrus hey! :)
var beg = beg.replace(/[.,-]/g,"");
var beg_array=beg.split(" ");
ans1.innerHTML=beg_array.length;
beg is the string
Melissa Guerrero
@Mmgfrog
Jun 22 2016 01:37
var farenheit = (celsius)*=9/5+32; why isn't this working?
Michael Karpinski
@karpimpski
Jun 22 2016 01:37
@huynhmatt using [,\.-] selects all of the periods in mine
Norvin Burrus
@ndburrus
Jun 22 2016 01:37
@huynhmatt another tool you may find useful: Regex101 :sparkles:
huynhmatt
@huynhmatt
Jun 22 2016 01:38
It,was,the,best,of,times,it,was,the,worst,of,times it,was,the,age,of,wisdom,it,was,the,age,of,foolishness it,was,the,epoch,of,belief,it,was,the,epoch,of,incredulity, it,was,the,season,of,Light,it,was,the,season,of,Darkness, it,was,the,spring,of,hope,it,was,the,winter,of,despair, we,had,everything,before,us,we,had,nothing,before,us we,were,all,going,direct,to,Heaven,we,were,all,going,direct,the,other,way, in,short,the,period,was,so,far,like,the,present,period, that,some,of,its,noisiest,authorities,insisted,on,its,being,received, for,good,or,for,evil,in,the,superlative,degree,of,comparison,only
Norvin Burrus
@ndburrus
Jun 22 2016 01:38
@Mmgfrog are there 2 assignments here: var farenheit = (celsius)*=9/5+32 ?
huynhmatt
@huynhmatt
Jun 22 2016 01:38
i put in the [,.-] and it still showed this
Michael Karpinski
@karpimpski
Jun 22 2016 01:39
@huynhmatt i get 115 matches
huynhmatt
@huynhmatt
Jun 22 2016 01:39
times it, foolishness it, and us we
Diego Mayer
@Chrono79
Jun 22 2016 01:39
@huynhmatt https://repl.it/C3bK/22
you can use boundaries and match
Norvin Burrus
@ndburrus
Jun 22 2016 01:39
@wilsonkaya Which exercise (name) is this? :sparkles:
Melissa Guerrero
@Mmgfrog
Jun 22 2016 01:40
@ndburrus no, I just want to convert farenheit to celsius
huynhmatt
@huynhmatt
Jun 22 2016 01:40
1 sec i think i just figured it out
Norvin Burrus
@ndburrus
Jun 22 2016 01:40
@Mmgfrog yes, i understand. i'm pointing to the fact that the code sees 2 asignments in the code... hint: remove one of them... clear as mud? also, check spelling - fahrenheit ...
huynhmatt
@huynhmatt
Jun 22 2016 01:41
i got it! there was a typo in his string
Michael Karpinski
@karpimpski
Jun 22 2016 01:41
@huynhmatt awesome!
Diego Mayer
@Chrono79
Jun 22 2016 01:41
:+1:
huynhmatt
@huynhmatt
Jun 22 2016 01:41
he had spaces after each sentences besides the 1st, 2nd, and 6th sentences
i mean forgot
Andi Nguyen
@nghiann262
Jun 22 2016 01:42
hi everybody
huynhmatt
@huynhmatt
Jun 22 2016 01:42
thanks @karpimpski and @Chrono79 !
CamperBot
@camperbot
Jun 22 2016 01:42
huynhmatt sends brownie points to @karpimpski and @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1257 | @chrono79 |http://www.freecodecamp.com/chrono79
:cookie: 367 | @karpimpski |http://www.freecodecamp.com/karpimpski
Diego Mayer
@Chrono79
Jun 22 2016 01:43
with boundaries it doesn't matter if there are more spaces though
Melissa Guerrero
@Mmgfrog
Jun 22 2016 01:43
@ndburrus so if one were solving this just using algebra, Farenheit = (whatever degrees Celsius you have) times 9/5 +32
Andi Nguyen
@nghiann262
Jun 22 2016 01:43
someone could help me to do this example

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

function checkObj(checkProp) {
// Your Code Here

return "Change Me!";
}

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

Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".
Melissa Guerrero
@Mmgfrog
Jun 22 2016 01:44
how is that declaring two variables?
or assigning, pardon
Norvin Burrus
@ndburrus
Jun 22 2016 01:44
@Mmgfrog yes, absolutely correct. reference instructions: The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32. :+1:
huynhmatt
@huynhmatt
Jun 22 2016 01:44
@Chrono79 oh, i didn't know that. i added a space and it fixed the problem. on the link you sent, you see the sentence, "it was the worst of times,it was the age of wisdom"
Melissa Guerrero
@Mmgfrog
Jun 22 2016 01:45
@ndburrus ah yes, didn't catch the spelling mistake
huynhmatt
@huynhmatt
Jun 22 2016 01:45
times,it was the problem. when i added a space between it, it fixed it
Norvin Burrus
@ndburrus
Jun 22 2016 01:45
@Mmgfrog you're on fire :fire: nice job...
Andi Nguyen
@nghiann262
Jun 22 2016 01:46

@nghiann262
someone could help me to do this example

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

function checkObj(checkProp) {
// Your Code Here

return "Change Me!";
}

// Test your code by modifying these values
checkObj("gift");
Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".

Norvin Burrus
@ndburrus
Jun 22 2016 01:46
@nghiann262 Which exercise (name) is this?
Diego Mayer
@Chrono79
Jun 22 2016 01:46
don't you have 2 spaces in this case? ...other way -- in short... when removing the -- ? @huynhmatt
Andi Nguyen
@nghiann262
Jun 22 2016 01:46
@ndburrus Testing Objects for Properties
Terragy
@Terragy
Jun 22 2016 01:46
Does anyone get weird typing glitches when working on their mobiles?
wilsonkaya
@wilsonkaya
Jun 22 2016 01:47
hi I am having problem with java script "Using Objects for Lookups" exercise. Can anyone help me
Terragy
@Terragy
Jun 22 2016 01:47
I was working on returning ReturnReturnReturnReturnReturnReturnReturn (a < b) {
Alexander Køpke
@alexanderkopke
Jun 22 2016 01:47
I don't work on my mobile so I can't say if I would
Norvin Burrus
@ndburrus
Jun 22 2016 01:47
@nghiann262 ok, so how do you propose moving forward? hint: see sample code myObj.hasOwnProperty("top"); // true myObj.hasOwnProperty("middle"); // false
Terragy
@Terragy
Jun 22 2016 01:48
Returning boolean values from functions and it turned my code into that ^
Melissa Guerrero
@Mmgfrog
Jun 22 2016 01:48
Thank you @ndburrus
CamperBot
@camperbot
Jun 22 2016 01:48
mmgfrog sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 669 | @ndburrus |http://www.freecodecamp.com/ndburrus
huynhmatt
@huynhmatt
Jun 22 2016 01:48
@Chrono79 your right, i see the spaces
Terragy
@Terragy
Jun 22 2016 01:48
Will see if it's a device issue first, nothing on the issue tracker for it..
Norvin Burrus
@ndburrus
Jun 22 2016 01:48
@Mmgfrog you're welcome! will you be tackling the next exercise? :+1: "Declare String Variables" you may as well.... :)
huynhmatt
@huynhmatt
Jun 22 2016 01:49
@Chrono79 is there a way to use what you did using replace? i haven't learned match, console, log and stuff yet
like could it be replace(\b[a-z]+\b/gi);
Andi Nguyen
@nghiann262
Jun 22 2016 01:50
@ndburrus i have tried, but it return "change me!"
Melissa Guerrero
@Mmgfrog
Jun 22 2016 01:50
@ndburrus yes. after I make a phone call and get my kiddo to bed. LOL
Norvin Burrus
@ndburrus
Jun 22 2016 01:50
@Mmgfrog ok, cya in a few... :sparkles:
Diego Mayer
@Chrono79
Jun 22 2016 01:51
@huynhmatt show me what you got, the replace you used, and I'll tell you how to fix it
Norvin Burrus
@ndburrus
Jun 22 2016 01:51
@nghiann262 it returns what is in the code. we're supposed to change that part :) do you see how the sample code approaches getting the desired value? (ie which method is used...)
huynhmatt
@huynhmatt
Jun 22 2016 01:51
@Chrono79 var beg = beg.replace(/[.,-]/g,"");
var beg_array=beg.split(" ");
ans1.innerHTML=beg_array.length;
Andi Nguyen
@nghiann262
Jun 22 2016 01:53
@ndburrus you can help me by your code?
Norvin Burrus
@ndburrus
Jun 22 2016 01:54
This message was deleted
wilsonkaya
@wilsonkaya
Jun 22 2016 01:54

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

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

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

// Change this value to test
phoneticLookup("charlie");
Ican solve the problem

Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.
kevincauto
@kevincauto
Jun 22 2016 01:54
Hi guys. I've been starring at this one. The sample case at the bottom in not working. What am I missing?
function getIndexToIns(arr, num) {
  arr.sort();
  //case where num would be the largest number in array
  if(num > arr[arr.length-1]){
      return arr.length;
    }
  //case where num is smallest number in array
  if(num<=arr[0]){
      return 0;
    }
  //loop through the array, once num > element insert.
  for (i = 0; i<arr.length; i++ ){


    if(num<=arr[i] && num >= arr[i-1]){
        return i;
      }
  }
}

getIndexToIns([5, 3, 20, 3], 5);
wilsonkaya
@wilsonkaya
Jun 22 2016 01:55
@kevincauto kevin how do you screen shot the table
Diego Mayer
@Chrono79
Jun 22 2016 01:56
@huynhmatt before spliting you could chain another replace(" ", " "); <- two spaces for one
kevincauto
@kevincauto
Jun 22 2016 01:56
use "```" before and after your code
MrBurks
@mrburks
Jun 22 2016 01:56

I think I'm missing something....

function truncateString(str, num) {
if(str > num){
str = str.slice(str.length(0,num));
str = str.concat('...');
}
return str;
}

truncateString("A-tisket a-tasket A green and yellow basket", 11);

kevincauto
@kevincauto
Jun 22 2016 01:56
"back ticks" top left of your keyboard (likely)
Michael Karpinski
@karpimpski
Jun 22 2016 01:57
@kevincauto
Diego Mayer
@Chrono79
Jun 22 2016 01:57
@kevincauto to sort numbers you need to use a function
Michael Karpinski
@karpimpski
Jun 22 2016 01:57
@kevincauto make it arr = arr.sort()
and then you could just do arr[num]
Norvin Burrus
@ndburrus
Jun 22 2016 01:57
@wilsonkaya ok, take a peek at the sample code. :point_up: June 21, 2016 9:47 PM :sparkles: getting clearer?
Michael Karpinski
@karpimpski
Jun 22 2016 01:57
if i understand what you're doing correctly. idk if i do
kevincauto
@kevincauto
Jun 22 2016 01:58
Yeah @karpimpski arr = arr.sort(); doesn't seem to make a difference.
Michael Karpinski
@karpimpski
Jun 22 2016 01:59
@kevincauto well using arr.sort() and then calling arr calls the unsorted arr, not the sorted one
Diego Mayer
@Chrono79
Jun 22 2016 01:59
@kevincauto you could also count how many are less than your num and you got the index to insert that way
huynhmatt
@huynhmatt
Jun 22 2016 01:59
@Chrono79 actually, i don't think it's a space. i think it may be a new line but after adding the space in the string, i got the correct word count.
'It,was,the,best,of,times,it,was,the,worst,of,times, it,was,the,age,of,wisdom,it,was,the,age,of,foolishness, it,was,the,epoch,of,belief,it,was,the,epoch,of,incredulity, it,was,the,season,of,Light,it,was,the,season,of,Darkness, it,was,the,spring,of,hope,it,was,the,winter,of,despair, we,had,everything,before,us,we,had,nothing,before,us, we,were,all,going,direct,to,Heaven,we,were,all,going,direct,the,other,way, in,short,the,period,was,so,far,like,the,present,period, that,some,of,its,noisiest,authorities,insisted,on,its,being,received, for,good,or,for,evil,in,the,superlative,degree,of,comparison,only'
there's only a space when there is a new line in the string i gave
Diego Mayer
@Chrono79
Jun 22 2016 02:00
@karpimpski that's not true, sort modifies the array
Norvin Burrus
@ndburrus
Jun 22 2016 02:00
help format @wilsonkaya
huynhmatt
@huynhmatt
Jun 22 2016 02:00
i think i'll ask my professor tomorrow to see if it was okay for me to add the space in his string. @Chrono79 thanks for your help :smile:
CamperBot
@camperbot
Jun 22 2016 02:00
huynhmatt sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: huynhmatt already gave chrono79 points
wilsonkaya
@wilsonkaya
Jun 22 2016 02:00
@ndburrus Icant undesrtand how it can hlep me
Michael Karpinski
@karpimpski
Jun 22 2016 02:00
@Chrono79 sorry, i'm bouncing from ruby to javascript and i'm not sure which methods modify arrays
Diego Mayer
@Chrono79
Jun 22 2016 02:00
@kevincauto https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
I think your way of doing it won't work if the number is greater than all the numbers of the array
kevincauto
@kevincauto
Jun 22 2016 02:01
@karpimpski yeah you're not correct with that. Either way though, it still is not working. It clears 6 out of the 7 bullets
fald
@fald
Jun 22 2016 02:01
Hi; is there a cleaner way to deal with async calls? I'm using geolocation, and it seems I need a function inside the callback function (itself being called in a function), to get it to store variables correctly.
kevincauto
@kevincauto
Jun 22 2016 02:02
@Chrono79 I have the case at the very top. I have a comment.
fald
@fald
Jun 22 2016 02:02
Wait, no thats me not thinking it through, ignore
Diego Mayer
@Chrono79
Jun 22 2016 02:02
@kevincauto right, then fix the sort with a function, otherwise it sorts alphabetical, in the mdn link you have it
Norvin Burrus
@ndburrus
Jun 22 2016 02:02
@wilsonkaya the method will return a boolean (true/false) based on the condition of finding (or not finding) an object property... do you see the method being used?
kevincauto
@kevincauto
Jun 22 2016 02:03
@Chrono79 I got ya. let me try that out.
@Chrono79 Thanks man! That was it. Just needed to sort with a function there.
CamperBot
@camperbot
Jun 22 2016 02:05
kevincauto sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1258 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jun 22 2016 02:06
@kevincauto no problem, and keep in mind the other way I told you, less writing too ;)
Arsalan Savand
@ArsalanSavand
Jun 22 2016 02:08
Hi everyone
can someone help me with this?
function binaryAgent(str) {
  var letter = "";
  for (var i = 0; i < str.length; i++) {
    letter = String.fromCharCode(str[i]);
  }
  return letter;
}

binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111");
it returns a single red dot .
what is the problem?
Srinivasan
@kksrini89
Jun 22 2016 02:09
@ArsalanSavand first you have to convert the binary into decimal value
then only you can get it fromCharCode string value
Arsalan Savand
@ArsalanSavand
Jun 22 2016 02:10
@kksrini89 how do i do such thing?
Srinivasan
@kksrini89
Jun 22 2016 02:13
@ArsalanSavand you can do it like,
var values = str.split(' ');
for(var i =0;i<values.length;i++){
         var decimalValue = parseInt(values[i],2).toString(10);
         values[i] = String.fromCharCode(decimalValue);
}
return values.join('');
Arsalan Savand
@ArsalanSavand
Jun 22 2016 02:14
ok wait
Giorgio
@gDelgado14
Jun 22 2016 02:17
Hello!
Does anyone have any good resources on writing modular code? i.e. implementing the Single Responsibility Principle throughout my modules and my methods.
euniceki
@euniceki
Jun 22 2016 02:19
Hi, I was wondering if anyone could help explain the "nesting for loops" problem-- I am having a hard time understanding this:
var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
Peter Temple
@peter1403
Jun 22 2016 02:19
function destroyer(arr, num1, num2, num3) {
  // Remove all the values
  return arr.filter(function(a) {return a != num1 && a != num2 && a != num3;});
}

destroyer([3, 5, 1, 2, 2], 2, 3, 5);
hi guys this is how I completed the seek & destroy challenge, it works but I don;t think it's the right way of doing things, I need to know how to pass in the undetermined arguments following the array in a cleaner way
herowalking
@herowalking
Jun 22 2016 02:21
<script type="text/javascript">
var today = new Date();
$('.form_datetime').datetimepicker({
language: 'zh-CN',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
forceParse: 0,
showMeridian: 1,
minView: "month",
minDate: 0,
maxDate: 'today',
format:'yyyy-mm-dd',
autoclose:true,
pickerPosition:"bottom-right"
})
</script>
Diego Mayer
@Chrono79
Jun 22 2016 02:21
@peter1403 I think you shouldn't manually add parameters to your function
Use arguments object instead
herowalking
@herowalking
Jun 22 2016 02:21
how to set maxDate today?
it's not work like this
heymark
@heymark
Jun 22 2016 02:22
@peter1403 look into the arguments object
herowalking
@herowalking
Jun 22 2016 02:22
in Bootstrap DateTimePicker, I want to disable the dates after today
herowalking
@herowalking
Jun 22 2016 02:23
how to set the dates disabled after today in Bootstrap DateTimePicker? @everyone
Peter Temple
@peter1403
Jun 22 2016 02:24
@Chrono79 yeah just saw them thanks for the help everyone
CamperBot
@camperbot
Jun 22 2016 02:24
peter1403 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1259 | @chrono79 |http://www.freecodecamp.com/chrono79
herowalking
@herowalking
Jun 22 2016 02:26
thanks , let me try
blob
huynhmatt
@huynhmatt
Jun 22 2016 02:27
show the location of each occurence of the character "e" in the string "beg" on one line separated by commas in the span block with id="ans6" not sure what this means or how to start, can anyone tune in?
herowalking
@herowalking
Jun 22 2016 02:27
<script type="text/javascript">
$('.form_datetime').datetimepicker({
language: 'zh-CN',
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
forceParse: 0,
showMeridian: 1,
minView: "month",
format:'yyyy-mm-dd',
endDate: '+0d',
autoclose:true,
pickerPosition:"bottom-right"
})
</script>
it works ,thanks a lot @Chrono79
Diego Mayer
@Chrono79
Jun 22 2016 02:28
no problem
Leo
@Leodhy
Jun 22 2016 02:31
any one can tell me how to use Array.reduce() in the "Symmetric Difference" challenage?
Judy Z
@UrchinZ
Jun 22 2016 02:37
This message was deleted
This message was deleted
Randall Fine
@randallfine
Jun 22 2016 02:38
function translatePigLatin(str) {
  var vowels = ["a","e","i","o","u"];
var first;
var rest;
var newStr;
for (var i = 0; i < vowels.length; i++){
if (str[0] === vowels[i]){
return str+"way";
} else if (str[1] === "l"){
first = str.split("",2);
rest= str.substr(2,str.length);
return rest+first+"ay";
}else{
first= str.split("",1);
rest = str.substr(1,str.length);
newStr= rest+first+"ay"; 
}
}


  return newStr;
}

translatePigLatin("glove");
glove comes back as oveg,lay
anythoughts?
all the rest pass
Karyme
@kvie
Jun 22 2016 02:39
Hello guys! I'm on the challenge "Record Collection" in the JavaScript section. I typed up my code, and I'm getting a reference error saying that stringify is not defined. Stringify occurs in the default code before I've even touched it.
Tim McIntire
@tmcintire
Jun 22 2016 02:40
@kvilex I just got the same thing!
Shah07
@Shah0505
Jun 22 2016 02:41
type JSON.stringify
i think its a bug
Karyme
@kvie
Jun 22 2016 02:41
thanks
sounds like it
Tim McIntire
@tmcintire
Jun 22 2016 02:42
thanks, that got it! @Shah0505
CamperBot
@camperbot
Jun 22 2016 02:42
tmcintire sends brownie points to @shah0505 :sparkles: :thumbsup: :sparkles:
:cookie: 256 | @shah0505 |http://www.freecodecamp.com/shah0505
Shah07
@Shah0505
Jun 22 2016 02:42
wc guys
EnocPineda1109
@EnocPineda1109
Jun 22 2016 02:44
hi! need help in the 130 lesson, i don't understand the use of the camelCase
David Halls
@DavidHalls
Jun 22 2016 02:47
@EnocPineda1109 what do yo need
Tim McIntire
@tmcintire
Jun 22 2016 02:47
@kvilex did you get it to work? Mine will work in a codepen console, but it doesn't in the editor they provide
Norvin Burrus
@ndburrus
Jun 22 2016 02:48
@EnocPineda1109 Which exercise (name) is this? :smile:
EnocPineda1109
@EnocPineda1109
Jun 22 2016 02:49
thanks @Byzgig don't undestand the part fix the variable declarations and assignments so their names use camelCase.
CamperBot
@camperbot
Jun 22 2016 02:49
enocpineda1109 sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:cookie: 348 | @byzgig |http://www.freecodecamp.com/byzgig
David Halls
@DavidHalls
Jun 22 2016 02:49
what is the name of the challenge
@EnocPineda1109
EnocPineda1109
@EnocPineda1109
Jun 22 2016 02:50
@Byzgig Understanding Case Sensitivity in Variables
thanks @Byzgig
CamperBot
@camperbot
Jun 22 2016 02:51
enocpineda1109 sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:warning: enocpineda1109 already gave byzgig points
Tarif
@TarifChandan
Jun 22 2016 02:51
Hi everyone.
David Halls
@DavidHalls
Jun 22 2016 02:51
@EnocPineda1109 it wants you to fix thesevar StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver; so that they use camelCase <--- multi-word variable names have the first word in lowercase and the first letter of each subsequent word is capitalized.
EnocPineda1109
@EnocPineda1109
Jun 22 2016 02:53
@Byzgig yeah!! Thank you :) :+1: :clap:
CamperBot
@camperbot
Jun 22 2016 02:53
enocpineda1109 sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:warning: enocpineda1109 already gave byzgig points
Tarif
@TarifChandan
Jun 22 2016 02:53
Does it matter if I nest if statement inside an else? If I don't nest it will the code run the same way it ran when I nested it?
endlessetudes
@endlessetudes
Jun 22 2016 02:54
I was trying not to ask but I'm pretty stuck on Diff Two Arrays.
Anyone else have trouble with this one
Karyme
@kvie
Jun 22 2016 02:55
I'm back! So I'm still on Record Collection and I'm trying to delete a property when the value is blank. Here's my function:
function updateRecords(id, prop, value) {

// the important part is here!
  if (value === "") {
    delete collection[id][prop];
  }

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

  return collection;
}
EnocPineda1109
@EnocPineda1109
Jun 22 2016 02:56
thank you everyone for your help :+1: :sparkles: :clap: :sparkles:
Karyme
@kvie
Jun 22 2016 02:56
actually i have an idea...
got it! thanks for the help, guys!
Colin Harrison
@giraffesinspace
Jun 22 2016 02:57
can someone help me with profile lookup? I can't get it to return "No such property"
for (var i = 0; i <= 3; i++) {
if (contacts[i].firstName == firstName) {
return contacts[i][prop];
}if (contacts[i].prop == prop) {
return "No such property";
}
}return "No such contact";
EnocPineda1109
@EnocPineda1109
Jun 22 2016 02:58
tell us your idea!! @kvilex
Karyme
@kvie
Jun 22 2016 02:59
i had to return collection immediately after deleting the property, because the code below was resetting the property
Janodus
@janodus
Jun 22 2016 02:59
hey guys. i have a quick question regarding the "Truncate a string" challenge in Jscript.
the challenge brings up test #3, and it doesn't really make sense.
ariefrs
@ariefrs
Jun 22 2016 03:05
Does anyone can help me solving Test #174 It's about Stand inline Function
Jason Shoemaker
@kutsuya1
Jun 22 2016 03:10
@janodus test #3? looks like it should return str...
Janodus
@janodus
Jun 22 2016 03:11
@jason i meant #4.
@kutsuya1
Jason Shoemaker
@kutsuya1
Jun 22 2016 03:12
@janodus think of num as the maximum length....so truncateString("two", 5000); has nothing to truncate
Janodus
@janodus
Jun 22 2016 03:12
@kutsuya1 got it. since the limit goes above the actual characters, then there's no limit.
Jason Shoemaker
@kutsuya1
Jun 22 2016 03:13
@janodus yes, no need to truncate
Janodus
@janodus
Jun 22 2016 03:13
@jason solved. thanks
CamperBot
@camperbot
Jun 22 2016 03:13
janodus sends brownie points to @jason :sparkles: :thumbsup: :sparkles:
:cookie: 119 | @jason |http://www.freecodecamp.com/jason
Janodus
@janodus
Jun 22 2016 03:13
hmmm
Jason Shoemaker
@kutsuya1
Jun 22 2016 03:13
@janodus glad tohelp
Janodus
@janodus
Jun 22 2016 03:13
@kutsuya1 thanks
CamperBot
@camperbot
Jun 22 2016 03:13
janodus sends brownie points to @kutsuya1 :sparkles: :thumbsup: :sparkles:
:cookie: 396 | @kutsuya1 |http://www.freecodecamp.com/kutsuya1
Brendan Pierce
@Dorfnox
Jun 22 2016 03:14
Hey guys, I'm getting a "stringify is not defined" error - any ideas on how to fix it?
It was in the original code
Just scrolled up, and @Shah0505 mentioned to type in JSON.stringify - where do I type this in?
David Halls
@DavidHalls
Jun 22 2016 03:18
@ariefrs yea, i can help
Brendan Pierce
@Dorfnox
Jun 22 2016 03:18
'Record Collection' exercise
flyasapegasus
@flyasapegasus
Jun 22 2016 03:19
Hey, can somebody tell what what to do in "Word Blanks" section, I'm lost >_>
Jack C
@JackCameo
Jun 22 2016 03:21
Hey everyone, I'm stuck on the chunky monkey challenge. I'm not sure how I can break up the array by the argument size
I'd prefer helpful hints or direction not the solution
David Halls
@DavidHalls
Jun 22 2016 03:22
@JackCameo try Array.from(arguments)
Jack C
@JackCameo
Jun 22 2016 03:22
@Byzgig is that a prototype?
David Halls
@DavidHalls
Jun 22 2016 03:23
@JackCameo yes, a shorter version of one
Jack C
@JackCameo
Jun 22 2016 03:24
@Byzgig I was using a loop to break up the array, it was building the array based on size where I ran into a wall
David Halls
@DavidHalls
Jun 22 2016 03:25
@JackCameo this should give you something like [[1,2,3]2,3]
Jack C
@JackCameo
Jun 22 2016 03:27
its just giving me the arr that is being passed
Norvin Burrus
@ndburrus
Jun 22 2016 03:27
@EnocPineda1109 can you post what you've got now? or, is it resolved?
David Halls
@DavidHalls
Jun 22 2016 03:28
@JackCameo oh, i thought you were on a different challenge, your on chunky monkey?
Jack C
@JackCameo
Jun 22 2016 03:28
haha
the suggestions are slice and push
David Halls
@DavidHalls
Jun 22 2016 03:30
sorry man, led you astray :(
give me a sec
Norvin Burrus
@ndburrus
Jun 22 2016 03:33
@JackCameo reference the instructions guidance: Array.prototype.push() Array.prototype.slice() :sparkles: also these may be useful: Javascript Array Methods: Unshift(), Shift(), Push(), And Pop(), and JavaScript - Array slice() Method :+1: first, as you know, you may want to iterate over the array with a counter the counts/increases/iterates at the count of size... clear as mud?
Jack C
@JackCameo
Jun 22 2016 03:35
yes
and I'm pushing into a new array
Norvin Burrus
@ndburrus
Jun 22 2016 03:36
@JackCameo that would be correct! :+1: the new array (newArray?) variable you already setup, i assume :)
Jack C
@JackCameo
Jun 22 2016 03:37
@ndburrus yes
Brendan Pierce
@Dorfnox
Jun 22 2016 03:37
Solved: I just deleted it. lol
Norvin Burrus
@ndburrus
Jun 22 2016 03:38
@flyasapegasus o, in this exercise it's simply asking for a sentence (madlib) to be built. have you identified the sentence you'd like to build using the 4 given word parts/types? :sparkles: in my opinion, it makes it a little easier to start with the end result (ie what you're building... so you can see your target - an easily see what is missing, if anything, when done!) conceptually, when you have your sentence, you'll need a variable to store the result (sentence build), and filler words/strings (to ensure a complete sentence). :+1:
Jack C
@JackCameo
Jun 22 2016 03:43
@ndburrus I'm still lost. I don't know what my next step should be
Nathaniel Nasarow
@Torgian
Jun 22 2016 03:43
could I get a code review? :)
Norvin Burrus
@ndburrus
Jun 22 2016 03:43
:+1: @JackCameo ok, can you post what you've got so far?
Nathaniel Nasarow
@Torgian
Jun 22 2016 03:43
I think it's pretty good, and quite happy I came up with my own, just want it looked over.
Norvin Burrus
@ndburrus
Jun 22 2016 03:43
@Torgian what are you working on?
Nathaniel Nasarow
@Torgian
Jun 22 2016 03:44
falsey bouncy
bouncer*
var trueStuff = [];
function bouncer(arr) {
  // Don't show a false ID to this bouncer.

 var isTrue = function(truthy){
      return Boolean(truthy) === true;
      };

 return arr.filter(isTrue);

}
bouncer([false, null, 0, NaN, undefined, ""]);
huynhmatt
@huynhmatt
Jun 22 2016 03:44
can someone tell me what this means? show the location of each occurence of the character "e" in the string "beg" on one line separated by commas in the span block with id="ans6"
Norvin Burrus
@ndburrus
Jun 22 2016 03:44
@Torgian sure, [Falsy Bouncer], can you post your code, please?
Nathaniel Nasarow
@Torgian
Jun 22 2016 03:45
the var up top I need to delete, was part of my first code before I revised it
huynhmatt
@huynhmatt
Jun 22 2016 03:45
not sure what they mean by location of each occurence
Jack C
@JackCameo
Jun 22 2016 03:45
var newArray = [];
  for(i = 0; i < size; i++) {
    newArray.push(arr[i]);
    return newArray;
  }
Norvin Burrus
@ndburrus
Jun 22 2016 03:46
@Torgian nice, neat, clean.... would you like a prize? :+1: i assume it passes?
@huynhmatt the string location... :smile:
@JackCameo hmmm... what is this: size ? how do we iterate over an array length? :sparkles: also, we may want to use the guidance in the instructions (hint: slice?)
Jack C
@JackCameo
Jun 22 2016 03:48
oh lol i forgot to fix that
huynhmatt
@huynhmatt
Jun 22 2016 03:49
@ndburrus ah okay
Nathaniel Nasarow
@Torgian
Jun 22 2016 03:49
Yes, it passes @ndburrus
Norvin Burrus
@ndburrus
Jun 22 2016 03:49
@Torgian superb job :sparkles:
Nathaniel Nasarow
@Torgian
Jun 22 2016 03:49
although I just found that just writing return arr.filter(Boolean); makes the same result.
Norvin Burrus
@ndburrus
Jun 22 2016 03:50
@Torgian it does, you're absolutely right! :sparkles:
Nathaniel Nasarow
@Torgian
Jun 22 2016 03:50
@ndburrus thanks :)
CamperBot
@camperbot
Jun 22 2016 03:50
torgian sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 678 | @ndburrus |http://www.freecodecamp.com/ndburrus
Jack C
@JackCameo
Jun 22 2016 03:52
@ndburrus
var newArray = [];
  for(i = 0; i < arr.length; i++) {
    newArray.push(arr[i]);
  }
  return newArray;
David Halls
@DavidHalls
Jun 22 2016 03:53
@JackCameo sorry man, got wrapped up in what i was doing, you also need to use slice or splice on this challenge
Jack C
@JackCameo
Jun 22 2016 03:53
@Byzgig I see that but not sure how to use slice
David Halls
@DavidHalls
Jun 22 2016 03:54
@jack so slice basically just copies the array with your defined parameters
tot = arr.slice(0, 2) would give tot a result of something like [1,2]
Michael Mills
@rizz1337
Jun 22 2016 03:55
Hey, can anyone assist me with "Stand in Line"? It starts talking about Queues and I'm completely stuck. Feel like I'm missing a component here...
Jack C
@JackCameo
Jun 22 2016 03:55
@Byzgig my mistake, i understand how to use it but not sure how to implement it with size
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 03:56
Hi All, can anyone please help me in understanding "Record Collection" Question
David Halls
@DavidHalls
Jun 22 2016 03:56
@rizz1337 what happens when you push something onto an array?
Norvin Burrus
@ndburrus
Jun 22 2016 03:56
@JackCameo where is our slice?
Michael Mills
@rizz1337
Jun 22 2016 03:57
@Byzgig oh jeez, push and pull, completely forgot about those statements. Gimme one sec...
Jack C
@JackCameo
Jun 22 2016 03:58
@ndburrus I have no idea where and how i would use it here
Jack C
@JackCameo
Jun 22 2016 04:04
@Byzgig @ndburrus thank you
CamperBot
@camperbot
Jun 22 2016 04:04
jackcameo sends brownie points to @byzgig and @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 349 | @byzgig |http://www.freecodecamp.com/byzgig
:cookie: 679 | @ndburrus |http://www.freecodecamp.com/ndburrus
Michael Mills
@rizz1337
Jun 22 2016 04:15
@Byzgig What part of the "return item;" line do I need to change?
Colton Rogers
@regara
Jun 22 2016 04:15
anyone know the answer for Escape Sequences in Strings in javascript
David Halls
@DavidHalls
Jun 22 2016 04:15
@rizz1337 show me your code
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:16
@regara show me your code
Colton Rogers
@regara
Jun 22 2016 04:16

var myStr; // Change this line

myStr = "Here is a backslash: \. \n \t \t Here is a new line with two tabs.";

Muhammad Farhan Bin Brohan
@FarhanBrohan
Jun 22 2016 04:16
Hey all
Just wondering
How do I do validation for HTML Contact Form
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:17
@regara myStr =" \ \n \t \t"
Michael Mills
@rizz1337
Jun 22 2016 04:17
@Byzgig stupid question, but how do I paste code without spamming chat? There's 15 lines in total.
David Halls
@DavidHalls
Jun 22 2016 04:17
help format
CamperBot
@camperbot
Jun 22 2016 04:17

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

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

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

Colton Rogers
@regara
Jun 22 2016 04:17
thank you <3
Michael Mills
@rizz1337
Jun 22 2016 04:18
camper bot ftw, one moment...
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:18
@regara its not complete solution just partial one :P
Michael Mills
@rizz1337
Jun 22 2016 04:19
function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  arr.shift();
  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 8)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
@Byzgig It's the "scrolling through the array" part that I don't get, and I think that 'return item;' line has something to do with it. Idk how though.
DJ
@qualitymanifest
Jun 22 2016 04:21

@rizz1337

The nextInLine function should then return the element that was removed.

item is not the element that was removed. the element that was removed is the element that was shifted from arr

Norvin Burrus
@ndburrus
Jun 22 2016 04:21
@JackCameo ...sorry...took a little break... did you resolve it?
David Halls
@DavidHalls
Jun 22 2016 04:22
@rizz1337 you dont want to return item, item has not changed, what has changed?
A242
@A242
Jun 22 2016 04:23
Hi, in "Generate Random Fractions with JavaScript" how can I change randomFraction to a random number before using return?
David Halls
@DavidHalls
Jun 22 2016 04:24
@A242 create a var, modify it, then return the var
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:25
Can any one help me with "Record Collection" question in JavaScript
getting error "ReferenceError: stringify is not defined"
David Halls
@DavidHalls
Jun 22 2016 04:26
@Janardhan-Babu put JSON. infront of that stringify
A242
@A242
Jun 22 2016 04:28
@Byzgig Got it, thanks
CamperBot
@camperbot
Jun 22 2016 04:28
a242 sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:cookie: 350 | @byzgig |http://www.freecodecamp.com/byzgig
David Halls
@DavidHalls
Jun 22 2016 04:29
@A242 you could just return Math.random();
x981
@x981
Jun 22 2016 04:29
@Janardhan-Babu add JSON. before stringify
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:30
@Byzgig @x981 like this "var collectionCopy = JSON.parse( JSON. before.stringify(collection));"
x981
@x981
Jun 22 2016 04:30
only JSON.
@Janardhan-Babu
David Halls
@DavidHalls
Jun 22 2016 04:30
yea, i think it is just JSON.parse that you need
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:32
@Byzgig @x981 will check n let you know
A242
@A242
Jun 22 2016 04:35
@Byzgig Omg how can I be so dumb :O Thanks for your help, all I need to do was return Math.random(); like you said
CamperBot
@camperbot
Jun 22 2016 04:35
a242 sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:warning: a242 already gave byzgig points
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:36

@Byzgig @x981 still facing same error `var collectionCopy = JSON.parse(stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {

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

} else delete collection[id][prop];

return collection;
}
`

David Halls
@DavidHalls
Jun 22 2016 04:37
help format
CamperBot
@camperbot
Jun 22 2016 04:37

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

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

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

David Halls
@DavidHalls
Jun 22 2016 04:37
post your whole code like this
@A242 your not dumb, sometimes we just have to overcomplicate things, like alot
Norvin Burrus
@ndburrus
Jun 22 2016 04:42
@JackCameo note for review: in this line: for(i = 0; i < arr.length; i++), we want to iterate over the array (and this is important) in "size" elements. this mean that we want to iterate in chunks (play on words). so, the counter cannot simply increase by 1 for each iteration (unless, of course the size is given as 1). next, the slice command. these may be useful: JavaScript : Array.splice() vs Array.slice(), Using Slice(), Substring(), And Substr() In Javascript, and JavaScript - Array slice() Method. the slice command has 2 parameters (start & size, basically). once the slice method syntax is place, we can push the glob/result into the new array! once all the iterations are done, the new array should have all the chunked slices in it! hopefully this adds some clarity! :)
Michael Mills
@rizz1337
Jun 22 2016 04:42
@Byzgig @qualitymanifest Well that took a lot longer than I care to admit, but your reminder of what should be returned eventually helped me out in passing that. Thank you both!
CamperBot
@camperbot
Jun 22 2016 04:42
rizz1337 sends brownie points to @byzgig and @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star2: 1215 | @qualitymanifest |http://www.freecodecamp.com/qualitymanifest
:cookie: 351 | @byzgig |http://www.freecodecamp.com/byzgig
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:43
Sorry all for poor code format
trying to get hang of it but failing :(
David Halls
@DavidHalls
Jun 22 2016 04:44
@Janardhan-Babu help format
help format @Janardhan-Babu
CamperBot
@camperbot
Jun 22 2016 04:44
no wiki entry for: format @janardhan-babu
David Halls
@DavidHalls
Jun 22 2016 04:44
help format
CamperBot
@camperbot
Jun 22 2016 04:44

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

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

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

David Halls
@DavidHalls
Jun 22 2016 04:44
@Janardhan-Babu
Lemmy
@imnotlammy
Jun 22 2016 04:50
var channels = ["freecodecamp", "storbeck", "terakilobyte", "habathcx","RobotCaleb","thomasballinger","noobs2ninjas","beohoff","brunofin","comster404","test_channel","cretetion","sheevergaming","TR7K","OgamingSC2","ESL_SC2"];

function getInfo() {
  channels.forEach(function(channel) {
    function makeURL (type, name) {
      return 'https://api.twitch.tv/kraken/' + type + '/' + name;
    };
    $.getJSON(makeURL("streams", channel), function(data) {
      var game, status;
      if (data.stream === null) {
        game = "offline";
        status = "offline"
      }
      else if (data.stream === undefined) {
        game = "account closed";
        status = "offline";
      }
      else {
        game = data.stream.game;
        status = "online";
      }
    })
    $.getJSON(makeURL("channels", channel),function(data) {
      var logo = data.logo != null ? data.logo : "http://s.jtvnw.net/jtv_user_pictures/hosted_images/GlitchIcon_WhiteonPurple.png";
      var description = status === "online" ? data.status : "offline";
      var html = "<div class='media'><a class='media-left' href="+data.url+"><img class='media-object' src="+logo+"></a><div class='media-body media-middle'><h4 class='media-heading'>"+data.name+"</h4>"+description+"</div></div>";
      status === "online" ? $('#output').prepend(html) : $('#output').append(html);
    })
  })
}

$(document).ready(function () {
  getInfo();
})
christianws
@christianws
Jun 22 2016 04:50
yo can anyone help with the 'No repeats please' algorithim?
Lemmy
@imnotlammy
Jun 22 2016 04:50
Can someone explain why this isn't working?
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:54
@Byzgig i am not able to post the code in proper format
huynhmatt
@huynhmatt
Jun 22 2016 04:55
push() just adds a value to an array right?
David Halls
@DavidHalls
Jun 22 2016 04:55
```
function randomFraction() {

  // Only change code below this line.

  return Math.random();

  // Only change code above this line.
}
@Janardhan-Babu just like that man
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:57
function randomFraction() {

  // Only change code below this line.

  return Math.random();

  // Only change code above this line.
}
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"
    }
};

var collectionCopy = JSON.parse(stringify(collection));

function updateRecords(id, prop, value) {


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

} else delete collection[id][prop]; 


  return collection;
}

updateRecords(5439, "artist", "ABBA");
David Halls
@DavidHalls
Jun 22 2016 04:59
JSON.parse(JSON.stringify(collection)); change to that
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 04:59
@Byzgig Thanks a ton...had to remove comments from the code before posting it..i am getting "ReferenceError: stringify is not defined " error
CamperBot
@camperbot
Jun 22 2016 04:59
janardhan-babu sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:cookie: 352 | @byzgig |http://www.freecodecamp.com/byzgig
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 05:00
@Byzgig Thanks :) it works
CamperBot
@camperbot
Jun 22 2016 05:00
janardhan-babu sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:warning: janardhan-babu already gave byzgig points
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 05:02
@huynhmatt yes it adds at the end of a array
@huynhmatt ```
var arr = [1,2,3];
MrBurks
@mrburks
Jun 22 2016 05:03

function switchOfStuff(val) {
var answer = "";
// Only change code below this line

switch (val){

case 1:
  answer = "apple";
  break;

case 2: 
  answer = "bird";
  break;

case 3:
  answer = "cat";
  break;

default: 
  answer = "stuff";

}

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

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

David Halls
@DavidHalls
Jun 22 2016 05:04
check out my calculator, i know i have some bugs, just looking for some feedback http://codepen.io/Byzgig/pen/dXpEPb
MrBurks
@mrburks
Jun 22 2016 05:08
:thumbsup:
@Byzgig thanks for sharing. it's quite nice.
CamperBot
@camperbot
Jun 22 2016 05:09
mrburks sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 05:09
@Byzgig cool
CamperBot
@camperbot
Jun 22 2016 05:09
:cookie: 353 | @byzgig |http://www.freecodecamp.com/byzgig
MrBurks
@mrburks
Jun 22 2016 05:09
@Byzgig can you help me with my bug?
David Halls
@DavidHalls
Jun 22 2016 05:10
@mrburks throw it at me man
MrBurks
@mrburks
Jun 22 2016 05:10

function switchOfStuff(val) {
var answer = "";
// Only change code below this line

switch (val){

case 1:
  answer =  "apple";
  break;

case 2: 
  answer =  "bird";
  break;

case 3:
  answer =  "cat";
  break;

default: 
  answer =  "stuff";

}

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

// Change this value to test
switchOfStuff(1);
I can't get it pass....but I don't see what is wrong with it. It looks quite standar.

allenewood
@allenewood
Jun 22 2016 05:11
```
David Halls
@DavidHalls
Jun 22 2016 05:11
@mrburks what is the challenge name
MrBurks
@mrburks
Jun 22 2016 05:11
@Byzgig Adding a default option in Switch statements
it's goes way back I skipped it a few days ago because of this issue
Now I'm going back to do the ones I skipped, still stuck on this one
allenewood
@allenewood
Jun 22 2016 05:12
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments);
  args.splice(0,1);
  return arr.fliter(function(element) {
   return args.indexOf(element) === -1; 
  });
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
MrBurks
@mrburks
Jun 22 2016 05:12
it's gotta be a typo somewhere I'm missing
allenewood
@allenewood
Jun 22 2016 05:12
Can anyone explane to me the return args.indexOf(element) === -1; part?
David Halls
@DavidHalls
Jun 22 2016 05:12
@mrburks it is looking for conidtions of 'a'.
allenewood
@allenewood
Jun 22 2016 05:12
and what is happening there?
explain*
CamperBot
@camperbot
Jun 22 2016 05:12
usage:
wiki $topic info on that topic
David Halls
@DavidHalls
Jun 22 2016 05:12
not 1,2,3
Norvin Burrus
@ndburrus
Jun 22 2016 05:13
@mrburks ...model the following, carefully:
"a" - "apple"
"b" - "bird"
"c" - "cat"
default - "stuff"
MrBurks
@mrburks
Jun 22 2016 05:13
@Byzgig but the val being passed to it, but the challenge itself is a number
Norvin Burrus
@ndburrus
Jun 22 2016 05:14
@mrburks ...and that "val" is handled here: switch (val){ :sparkles: from here: function switchOfStuff(val) {
MrBurks
@mrburks
Jun 22 2016 05:15
so, I really don't understand oneliners
can you be a bit more specific?
David Halls
@DavidHalls
Jun 22 2016 05:15
@mrburks they test several things, change your numbers to 'a', 'b', 'c' and you should pass
MrBurks
@mrburks
Jun 22 2016 05:16
I tried that already
it didn't work
Markus Kiili
@Masd925
Jun 22 2016 05:17
@allenewood That callback function function(element) { return args.indexOf(element) === -1;} tells filter how to filter one arbitrary arr element element. args has all the extra arguments, and the indexOf checks if element is not found on args. Therefore the callback function returns true for those elements that are not equal to any of the extra arguments.
David Halls
@DavidHalls
Jun 22 2016 05:17
@mrburks the computer runs the test, not the switchOfStuff(1);, they are testing for multiple outcomes
Norvin Burrus
@ndburrus
Jun 22 2016 05:17
@mrburks the function switchOfStuff receives val as input. that variable val is passed to the switch statement, where it is evaluated by case/s (a through c & default). what val equals determines the output ("apple", "bird", etc.). so, switchOfStuff(1) falls into the default (since it is not a, b, or c) - so it returns "stuff". output: => 'stuff'
David Halls
@DavidHalls
Jun 22 2016 05:18
@mrburks i ran your code, replacing the nums in the switch with "a" etc and it passes
Write a switch statement to set answer for the following conditions:
"a" - "apple"
"b" - "bird"
"c" - "cat"
default - "stuff"
MrBurks
@mrburks
Jun 22 2016 05:18

@Byzgig
function switchOfStuff(val) {
var answer = "";
// Only change code below this line

switch (val){

  case a:
  answer = "apple";
  break;

case b:
  answer =  "bird";
  break;

case c:
  answer =  "cat";
  break;

default: 
  answer =  "stuff";

}

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

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

David Halls
@DavidHalls
Jun 22 2016 05:19
those chars need to be in quotes
case a needs to be case "a"
MrBurks
@mrburks
Jun 22 2016 05:20

function switchOfStuff(val) {
var answer = "";
// Only change code below this line

switch (val){

  case "a"
  answer = "apple";
  break;

case "b"
  answer =  "bird";
  break;

case "c"
  answer =  "cat";
  break;

default: 
  answer =  "stuff";

}

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

// Change this value to test
switchOfStuff(a);

plus syntax errors
David Halls
@DavidHalls
Jun 22 2016 05:20
case "a":
Chris Drain
@Chrislearns
Jun 22 2016 05:20
I need help with FCC challenge Profile Lookup
heres my code
var proof = contacts.prop;
if (firstName && prop) contacts[prop] = proof;
if(!!firstName) return "No such contact";
if(!!prop) return "No sudh do";
return contacts;
MrBurks
@mrburks
Jun 22 2016 05:20
ok that took care of the syntax errors but still no go
David Halls
@DavidHalls
Jun 22 2016 05:21
k, repost your code
Markus Kiili
@Masd925
Jun 22 2016 05:21
@Chrislearns contacts is an array. You need to loop or iterate through it.
MrBurks
@mrburks
Jun 22 2016 05:21
hm...hey I'm gonna teach you guys how to play guitar. hears a guitar. now play "panama"
lol

function switchOfStuff(val) {
var answer = "";
// Only change code below this line

switch (val){

case "a":
  answer = "apple";
  break;

case "b":
  answer =  "bird";
  break;

case "c":
  answer =  "cat";
  break;

default: 
  answer =  "stuff";

}

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

// Change this value to test
switchOfStuff(a);

Chris Drain
@Chrislearns
Jun 22 2016 05:22
@Masd925 ok ok ok I just did that in the previous few challenges brb Thank You
CamperBot
@camperbot
Jun 22 2016 05:22
chrislearns sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1950 | @masd925 |http://www.freecodecamp.com/masd925
Norvin Burrus
@ndburrus
Jun 22 2016 05:23
@mrburks syntax/format is important. see the example code format? case value1:
David Halls
@DavidHalls
Jun 22 2016 05:23
@mrburks you changed the computer code
this needs to be your last line switchOfStuff(1);
Rabin Shrestha
@jyapujuju
Jun 22 2016 05:24

// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

// Only change code below this line
myStorage.car["inside"].glove box;
var gloveBoxContents = "map"; // Change this line
whats wrong here
Markus Kiili
@Masd925
Jun 22 2016 05:24
@jyapujuju The dot notation only works if the property key string is a valid JS identifier (for example "12" and "lives left" are not) and you write the key after the dot: var cat={clothes:"pants", "lives left":3}; cat.clothes; //returns "pants". Bracket notation works with keys that can be arbitrary strings cat["lives left"]; //returns 3, variables var key="clothes"; cat[key]; //returns "pants", or expressions cat["lives"+" "+"left"]; //returns 3.
MrBurks
@mrburks
Jun 22 2016 05:24
@Byzgig ok that worked but no I'm even more confused. if the value being passed into the function is numeral but the cases are notated in "apha" how does that line up?
David Halls
@DavidHalls
Jun 22 2016 05:24
get rid of the space in glove box
@mrburks the computer is running its own tests, you changed code that the computer was expecting to be a certain way and it wasnt so if failed you

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

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

Norvin Burrus
@ndburrus
Jun 22 2016 05:25
@mrburks see previous comment :point_up: June 22, 2016 1:17 AM
Markus Kiili
@Masd925
Jun 22 2016 05:25
@jyapujuju So "glove box" is not a valid identifier and therefore you must use bracket notation.
David Halls
@DavidHalls
Jun 22 2016 05:26
you changed switchOfStuff(1);
Thu
@thupham17
Jun 22 2016 05:26
Can someone catch the error here? I've been looking at it for a while and nothing...
John Peters
@Jaker42
Jun 22 2016 05:26
擷取.PNG
Thu
@thupham17
Jun 22 2016 05:26

function mutation(arr) {
arr[0] = arr[0].toLowerCase;
arr[1] = arr[1].toLowerCase;
for (i=0; i<arr[1].length; i++) {
if (arr[0].indexOf(arr[1][i]) < 0) {
return false;
}
}
return true;
}

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

MrBurks
@mrburks
Jun 22 2016 05:26
@Byzgig yeah we never know when they want us to change input values or not. it's so flippy-floppy and so inconsistent.
Guitar-school
John Peters
@Jaker42
Jun 22 2016 05:27
I don't get why the two problems.
Markus Kiili
@Masd925
Jun 22 2016 05:27
@thupham17 Parens here .toLowerCase() <-
David Halls
@DavidHalls
Jun 22 2016 05:27
do you use rep.it?
MrBurks
@mrburks
Jun 22 2016 05:27
I started using it today
David Halls
@DavidHalls
Jun 22 2016 05:28
good
Thu
@thupham17
Jun 22 2016 05:29
thanks @Masd925
CamperBot
@camperbot
Jun 22 2016 05:29
thupham17 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1951 | @masd925 |http://www.freecodecamp.com/masd925
David Halls
@DavidHalls
Jun 22 2016 05:29
console.log() is your bud
Rabin Shrestha
@jyapujuju
Jun 22 2016 05:30

// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

// Only change code below this line
myStorage.car.inside["glove box"];
var gloveBoxContents = "maps"; // Change this line
what about now?
David Halls
@DavidHalls
Jun 22 2016 05:30
myStorage.car.inside["glove box"];
var gloveBoxContents = "maps";?????
Krishna Sai Gullapalli
@Krish2704
Jun 22 2016 05:31
@jyapujuju you should give that myStorage.car.inside["glove box"] to gloveBoxContents
John Peters
@Jaker42
Jun 22 2016 05:32
var myStr = "Here is a backlash: \\\n\t\t Here is a new line with two tabs.";  // Change this line
I need to understand what problem I have in this challenge.
David Halls
@DavidHalls
Jun 22 2016 05:33
@Jaker42 challenge asks for spaces, you have none
Krishna Sai Gullapalli
@Krish2704
Jun 22 2016 05:33
@jyapujuju var gloveBoxContents = myStorage.car.inside["glove box"];
like this
John Peters
@Jaker42
Jun 22 2016 05:34

But a requirement states:

myStr should not have any spaces in between consecutive escape sequences.

David Halls
@DavidHalls
Jun 22 2016 05:34
challenge name pls
John Peters
@Jaker42
Jun 22 2016 05:34
Challenge Escape Sequences in Strings
in JavaScript
MrBurks
@mrburks
Jun 22 2016 05:39
@Byzgig thanks
CamperBot
@camperbot
Jun 22 2016 05:39
mrburks sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:warning: mrburks already gave byzgig points
kirbyedy
@kirbyedy
Jun 22 2016 05:42
@Jaker42 \t and capital H have space, remove that one
JC Santos
@jsantos108
Jun 22 2016 05:46
Can anyone see see what

Can anyone see what's wrong here before I submit a bug?

function mutation(arr) {
var check;
while(check!==false){
for(var i=0;i<arr[1].length;i++){ check=(arr[0].indexOf(arr[1][i])>-1);
}
}
return check;
}

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

John Peters
@Jaker42
Jun 22 2016 05:47
@kirbyedy doesn't solve that problem
kirbyedy
@kirbyedy
Jun 22 2016 05:47
@Jaker42 can you paste it again, maybe you have another space somewhere
where \n or \t is
John Peters
@Jaker42
Jun 22 2016 05:48
var myStr = "Here is a backlash:\\\n\t\tHere is a new line with two tabs.";  // Change this line
kirbyedy
@kirbyedy
Jun 22 2016 05:48
@Jaker42 put a space after :
John Peters
@Jaker42
Jun 22 2016 05:49
@kirbyedy I've tried it
kirbyedy
@kirbyedy
Jun 22 2016 05:49
and I think there should be a .
after double \
Krishna Sai Gullapalli
@Krish2704
Jun 22 2016 05:49
@kirbyedy
John Peters
@Jaker42
Jun 22 2016 05:49
@kirbyedy Doesn't work
kirbyedy
@kirbyedy
Jun 22 2016 05:50
"Here is a backslash: \\.\n\t\tHere is a new line with two tabs."
this should work @Jaker42
John Peters
@Jaker42
Jun 22 2016 05:51
@kirbyedy That worked, thank you
CamperBot
@camperbot
Jun 22 2016 05:51
jaker42 sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1138 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 05:53
@jsantos108 what is the problem name?
JC Santos
@jsantos108
Jun 22 2016 05:53
@Janardhan-Babu "Mutations"
Front End Development > Basic Algorithm Scripting >Mutations
Janardhan-Babu
@Janardhan-Babu
Jun 22 2016 05:58
@jsantos108 im not sure about the logic you have written
Markus Kiili
@Masd925
Jun 22 2016 05:58
@jsantos108 Because you overwrite check on for loop, it actually checks the last character of second string.
While loop is also infinite if the last character is found.
JC Santos
@jsantos108
Jun 22 2016 06:00
ooo. ok i'll rewrite as for loop
I hope that fixes it
Markus Kiili
@Masd925
Jun 22 2016 06:01
@jsantos108 You should just loop second string characters and if the character is not found, return false. Figure out where to return true.
check variable just obscures the logic.
Faiz Ahmad Faiz
@Faizahmadfaiz
Jun 22 2016 06:02
@jsantos108
```
@jsantos108

function mutation(arr) {
    var check;
      arr[0] = arr[0].toLowerCase();
           arr[1] = arr[1].toLowerCase();
        for(var i=0;i<arr[1].length;i++){
            check=(arr[0].indexOf(arr[1][i])>-1);
            if(check === false) {
                break;
            }
        }

    return check;
}
mutation(["hello", "hey"]);
JC Santos
@jsantos108
Jun 22 2016 06:06
Thanks everyone
Markus Kiili
@Masd925
Jun 22 2016 06:07
@Faizahmadfaiz @jsantos108 I think it is even simpler without using check:
function mutation(arr) {
  var first = arr[0].toLowerCase();
  var second = arr[1].toLowerCase();
  for (i=0; i<second.length; i++) {
    if (first.indexOf(second.charAt(i))===-1) return false;
  }
  return true;
}
JC Santos
@jsantos108
Jun 22 2016 06:09
agreed. It's funny how close I get to these solutions but miss one little piece
Thanks again everyone. Time to catch a little sleep
Jon
@Antiphilous
Jun 22 2016 06:17
ok so I have a question which is confusing me

why is it when I add these to numbers together like this

var cidTotal =  1.01 + 2.05;

I get 3.05999999999999996 rather than 3.06

William L
@deeninja
Jun 22 2016 06:19
hi guys
im stuck on js exercise
counting cards
can anyone help :S
Jon
@Antiphilous
Jun 22 2016 06:20
@deeninja sure I can help while I wait to figure out my oddity
William L
@deeninja
Jun 22 2016 06:20
Thanks man
have you done it yet?
Jon
@Antiphilous
Jun 22 2016 06:20
@deeninja yeah
William L
@deeninja
Jun 22 2016 06:20
its probably too early in the morning for something like this haha
ok so
task:
You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative. The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
Jon
@Antiphilous
Jun 22 2016 06:21
@kirbyedy Thank you, do you have any idea why it adds it like though? just curious how javascript adds the number
CamperBot
@camperbot
Jun 22 2016 06:21
antiphilous sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1139 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
William L
@deeninja
Jun 22 2016 06:21
What I have so far

var count = 0;

function cc(card) {
// Only change code below this line
switch(card) {
case 2:
count++;
return count + ' Bet';
case 3:
count++;
return count + ' Bet';
case 4:
count++;
return count + ' Bet';
case 5:
count++;
return count + ' Bet';
case 6:
count++;
return count + ' Bet';
case 7:
count = 0;
return count + ' Hold';
case 8:
count = 0;
return count + ' Hold';
case 9:
count = 0;
return count + ' Hold';
case 10:
count-=1;
return count + ' Bet';
case 'J':
case 'Q':
case 'K':
case 'A':
return count-=1;

}

return count + "Bet";
// Only change code above this line
}

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

kirbyedy
@kirbyedy
Jun 22 2016 06:21
@Antiphilous its a javascript "feature" :)
Jon
@Antiphilous
Jun 22 2016 06:22
@kirbyedy lol I love "features"
@kirbyedy Once again I appreciate the help
William L
@deeninja
Jun 22 2016 06:23
:?
Jon
@Antiphilous
Jun 22 2016 06:23
@deeninja can you remind me the name of the challenge?
William L
@deeninja
Jun 22 2016 06:23
counting cards
Jon
@Antiphilous
Jun 22 2016 06:23
nvm got it
William L
@deeninja
Jun 22 2016 06:24
ive tried the above, and also tried grouping the cases together then the expression after the each group
Jon
@Antiphilous
Jun 22 2016 06:24
@deeninja hmm well I can tell you right now you're missing somethign important
looks like you got no breaks
William L
@deeninja
Jun 22 2016 06:25
normally i always use breaks
but return does the same thing in this context
you cant return and break
awbunys
@awbunys
Jun 22 2016 06:25
deeninja you can also shorten that up a lot too when it comes to your hold and bet returns
William L
@deeninja
Jun 22 2016 06:26
will do after it works :D
I had it like this before
case1:
case2:
case3:
case4:
etc
count++;
return count + ' Bet';
am i way off?
awbunys
@awbunys
Jun 22 2016 06:27
compared to what i did no
William L
@deeninja
Jun 22 2016 06:27
ah well thats great
awbunys
@awbunys
Jun 22 2016 06:27
on your 2nd one that is
William L
@deeninja
Jun 22 2016 06:27
but she no works :S
Jon
@Antiphilous
Jun 22 2016 06:28
@deeninja well another thing is your last return beneath the Face Cards is trying to subtract one from the count as well as say bet
William L
@deeninja
Jun 22 2016 06:29
took it out
only 3 have ticks
rest are wrong
:/
awbunys
@awbunys
Jun 22 2016 06:30
what are you missing still
William L
@deeninja
Jun 22 2016 06:30

my code now:

var count = 0;

function cc(card) {
// Only change code below this line
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
return count + ' Bet';
case 7:
case 8:
case 9:
count = 0;
return count + ' Hold';
case 10:
count-=1;
return count + ' Bet';
case 'J':
case 'Q':
case 'K':
case 'A':
return count-=1;

}
// Only change code above this line
}

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

Jon
@Antiphilous
Jun 22 2016 06:30
@deeninja I think you are getting lucky with hitting the ticks
to be honest
William L
@deeninja
Jun 22 2016 06:30
so what am i doing wrong
awbunys
@awbunys
Jun 22 2016 06:30
theres no breaks in there
William L
@deeninja
Jun 22 2016 06:31
but you cant return and break mate
if cases match
Jon
@Antiphilous
Jun 22 2016 06:31
@deeninja Ahh yes but huge hint
you are not supposed to return anything once it matches the case
William L
@deeninja
Jun 22 2016 06:31
js returns the parameters after return
Shraddha Parab
@Shraddha99
Jun 22 2016 06:31
@jessetmccullough I was working on Return Largest Numbers in array When I found your msg on the same and also a different way than what I was dng to solve the same problem ..then i corrected your method . ``js
William L
@deeninja
Jun 22 2016 06:31
and stops the unction
Jon
@Antiphilous
Jun 22 2016 06:31
@deeninja You don't want it to stop
William L
@deeninja
Jun 22 2016 06:31
ahh
ok let me try
Jon
@Antiphilous
Jun 22 2016 06:32
I think you don't understand the card counting and why a player bets or holds
William L
@deeninja
Jun 22 2016 06:32
probs not
never been into cards
Shraddha Parab
@Shraddha99
Jun 22 2016 06:32
@jessetmccullough ```js
Jon
@Antiphilous
Jun 22 2016 06:32
@deeninja thats fine
Shraddha Parab
@Shraddha99
Jun 22 2016 06:32

function largestOfFour(arr) {
  // You can do this!

  //Arrays to be populated later
  var sortedArray = [];
  var largestNumbers = [];
  var abc;

  //Sort each nested array item from smallest to largest. Problem: this is going through 16 times (the number of total characters in the original array)

    for ( j = 0; j < arr.length; j++ )
    {
       abc = arr[j].sort(function(a, b){return b-a;});
      sortedArray.push(abc);
    }

   //return sortedArray;

  //Slice the first number in the sortedArray (which should be the largest) into the largestNumbers array
  for( k = 0; k < sortedArray.length; k++)
 {
    largestNumbers.push(sortedArray[k][0]); 
 }




return largestNumbers;
}

 largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
awbunys
@awbunys
Jun 22 2016 06:32
@deeninja i was able to do a return outside of the {} on my switch
kirbyedy
@kirbyedy
Jun 22 2016 06:33
isn`t it easier to solve the card counting problem with if else statement
awbunys
@awbunys
Jun 22 2016 06:33
and I shrunk down my code to return the count + a statement on if it was to bet or hold
kirbyedy
@kirbyedy
Jun 22 2016 06:33
less chances of making a mistake I think...
William L
@deeninja
Jun 22 2016 06:34
tweaking it to see something
will get back nownow
:)
Jon
@Antiphilous
Jun 22 2016 06:35
@deeninja alright I see all your problems
Huge hint which is on the side
Do Not reset count to 0 when value is 7, 8 or 9
you are currently doing that
@Shraddha99 have you gotten some help yet?
William L
@deeninja
Jun 22 2016 06:39
sigh ok now everything is wrong
:(

var count = 0;

function cc(card) {
// Only change code below this line
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 7:
case 8:
case 9:
count = 0;
break;
case 10:
count-=1;
break;
case 'J':
case 'Q':
case 'K':
case 'A':
count-=1;
break;
case (card > 1 || card < 11):
return count + " Bet";
case card <= 0:
return count + " Hold";
}

// Only change code above this line
}

awbunys
@awbunys
Jun 22 2016 06:39
@deeninja try doing += 0 instead of just equalling to 0
Jon
@Antiphilous
Jun 22 2016 06:40
yes
Otherwise you are resetting the value
awbunys
@awbunys
Jun 22 2016 06:40
that way it isnt resetting to 0, but its just adding nothing
William L
@deeninja
Jun 22 2016 06:40
yea
my bad
too early in morning hehe, i knew that
Jon
@Antiphilous
Jun 22 2016 06:40
@deeninja second of all don't use another case statement at the end
William L
@deeninja
Jun 22 2016 06:40
:S
Jon
@Antiphilous
Jun 22 2016 06:40
@Antiphilous use an if
William L
@deeninja
Jun 22 2016 06:40
I did at furst
Jon
@Antiphilous
Jun 22 2016 06:40
@deeninja you can do it man
William L
@deeninja
Jun 22 2016 06:40
then changed it
Jon
@Antiphilous
Jun 22 2016 06:41
Just at the very end

case (card > 1 || card < 11):
return count + " Bet";
case card <= 0:
return count + " Hold";
}

// Only change code above this line
}'

William L
@deeninja
Jun 22 2016 06:41

var count = 0;

function cc(card) {
// Only change code below this line
switch(card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 7:
case 8:
case 9:
count+= 0;
break;
case 10:
count-=1;
break;
case 'J':
case 'Q':
case 'K':
case 'A':
count-=1;

}

if(card > 1 || card < 11) {
return count + " Bet";
} else if (card <= 0) {

return count + " Hold";

}

// Only change code above this line
}

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

Jon
@Antiphilous
Jun 22 2016 06:41
ok
im gonna help you out
so if the count is low you hold
any count less than 0 you hold
anything else higher you bet on
William L
@deeninja
Jun 22 2016 06:42
yep
ok wait
Jon
@Antiphilous
Jun 22 2016 06:42
so you don't need card or anything you only need the count now
William L
@deeninja
Jun 22 2016 06:43

if(count > 1 || count < 11) {
return count + " Bet";
} else if (count <= 0) {

return count + " Hold";

}

Jon
@Antiphilous
Jun 22 2016 06:43
you dont even need that much
William L
@deeninja
Jun 22 2016 06:44
its not working still
:S
Jon
@Antiphilous
Jun 22 2016 06:44
if( count <= 0){
return count + hold}else{
because your first if statement is always evaluating to true
use your second one

if (count <= 0) {

return count + " Hold";

} else {
return count + bet}

your close you just gotta flip it around a lil
William L
@deeninja
Jun 22 2016 06:46
ok it works now
but why???
the order shouldnt matter?
if count is between 1 and 11 return bet, else if its under 0 return hold
Jon
@Antiphilous
Jun 22 2016 06:47
that's not what it was saying
lets take a look at it
William L
@deeninja
Jun 22 2016 06:48
if count under 0 return hold, else if its count is between 1 and 11 return bet,
same thing
different order
Jon
@Antiphilous
Jun 22 2016 06:48
the second one is always true
you said
if(count > 1 || count < 11) {
Islam Ibakaev
@dagman
Jun 22 2016 06:48
very useful tips if you are using codepen as playground -> http://www.hongkiat.com/blog/codepen-tips-beginners/
Jon
@Antiphilous
Jun 22 2016 06:48
|| means Or
William L
@deeninja
Jun 22 2016 06:48
yep i know
Jon
@Antiphilous
Jun 22 2016 06:49
ok so lets take the number -1
is it greater than 1?
nope
William L
@deeninja
Jun 22 2016 06:49
no
Jon
@Antiphilous
Jun 22 2016 06:49
is it less than 11
yes
William L
@deeninja
Jun 22 2016 06:49
omg
:P
Jon
@Antiphilous
Jun 22 2016 06:49
:D
lol
William L
@deeninja
Jun 22 2016 06:49
so if thatt were &&
it would work
Jon
@Antiphilous
Jun 22 2016 06:49
yeah
William L
@deeninja
Jun 22 2016 06:49
hahahaha
gzuz
Jon
@Antiphilous
Jun 22 2016 06:49
but keep in mind you wouldnt need that
William L
@deeninja
Jun 22 2016 06:50
yea
this ways shorter
this was too big a problem for first thing waking up
Jon
@Antiphilous
Jun 22 2016 06:50
because your holding on anything less than or equal to zero
William L
@deeninja
Jun 22 2016 06:50
methinks
thanks dude
Jon
@Antiphilous
Jun 22 2016 06:50
haha
no problem we all have those moments
William L
@deeninja
Jun 22 2016 06:50
where you feel utterly stupid?
happysalada
@happysalada
Jun 22 2016 06:50
hey guys sorry to bother, I am at the drop it challenge and I don't understand the second validation statement
dropElements([0, 1, 0, 1], function(n) {return n === 1;}) should return [1, 0, 1]
to me it should return 1
the other statement that is weird is this one
dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;}) should return [3, 9, 2].
to me it should return []
Jon
@Antiphilous
Jun 22 2016 06:51
@deeninja oh yeah man wait till you forget a semi colon or something
spend 20 mins looking at your code thinking you suck and then you realize you just forget a comma...
@happysalada one moment
William L
@deeninja
Jun 22 2016 06:52
yea man done that many times hehe
Markus Kiili
@Masd925
Jun 22 2016 06:52
@happysalada You drop elements until the function returns true for the element. [0, 1, 0, 1], function(n) {return n === 1;} drops the first only.
William L
@deeninja
Jun 22 2016 06:52
but thanks jon mate
i appreciate your patient guidance
happysalada
@happysalada
Jun 22 2016 06:53
@Masd925 oh you check element by element not if all the rest of the elements are true
Jon
@Antiphilous
Jun 22 2016 06:53
@deeninja No worries makes me feel good I understand it enough to help people.
happysalada
@happysalada
Jun 22 2016 06:53
@Masd925 got it thank you
CamperBot
@camperbot
Jun 22 2016 06:53
happysalada sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1952 | @masd925 |http://www.freecodecamp.com/masd925
awbunys
@awbunys
Jun 22 2016 06:53
on Manipulating Complex Objects, is it just looking for me to use push to add the next artist/song?
William L
@deeninja
Jun 22 2016 06:53
following you on github @Antiphilous
is there a way to add people on gitter to chat in future?
Jon
@Antiphilous
Jun 22 2016 06:54
That I do not know....
William L
@deeninja
Jun 22 2016 06:54
ye man it must feel great, how long you been coding for?
ah ok
Jon
@Antiphilous
Jun 22 2016 06:54
4 months really into it
Markus Kiili
@Masd925
Jun 22 2016 06:54
@awbunys If it was the challenge with the array literal, just copy-paste another object to the array and change data.
William L
@deeninja
Jun 22 2016 06:55
rad
Lemmy
@imnotlammy
Jun 22 2016 06:55
var channels = ["freecodecamp", "storbeck", "terakilobyte", "habathcx","RobotCaleb","thomasballinger","noobs2ninjas","beohoff","brunofin","comster404","test_channel","cretetion","sheevergaming","TR7K","OgamingSC2","ESL_SC2", "SuperMCGamer"];

function getInfo() {
  var status;
  channels.forEach(function(channel) {
    function makeURL (type, name) {
      return 'https://api.twitch.tv/kraken/' + type + '/' + name + "?callback=?";
    };
    $.getJSON(makeURL("streams", channel), function(data) {    
      if (data.stream == null) {
        status = "offline"
      }
      else if (data.stream == 422) {
        status = "account closed";
      }
      else if (data.stream == 404) {
        status = "error";
      }
      else {
        status = "online";
      };
    });
    $.getJSON(makeURL("channels", channel),function(data) {
      var logo = data.logo != null ? data.logo : "http://s.jtvnw.net/jtv_user_pictures/hosted_images/GlitchIcon_WhiteonPurple.png";
      var description = status == "online" ? data.status : status;
      var html = "<div class='media'><a class='media-left' href='" + data.url + "'><img class='media-object' src='" + logo + "'></a><div class='media-body media-middle'><h4 class='media-heading'>" + data.display_name + "</h4>" + description + "</div></div>";
      status === "online" ? $('#output').prepend() : $('#output').append(html);
    });
  });
};

$(document).ready(function () {
  getInfo();
});
William L
@deeninja
Jun 22 2016 06:55
me too about that time
Lemmy
@imnotlammy
Jun 22 2016 06:55
can someone tell help me?
The function terminates after hitting the first if
how to avoid this?
Jon
@Antiphilous
Jun 22 2016 06:56
@deeninja nice I just have been able to do some each day it's practice is all
happysalada
@happysalada
Jun 22 2016 06:56
I have one more question. On the smallest common multiplier I entered code that makes chrome unresponsive. If I kill the window and refresh the page I don't have time to hit reset, the page freezes straight away. Is there a way to ask the admin to reset my code?
awbunys
@awbunys
Jun 22 2016 06:57
@Masd925 Im not sure if its the same one youre referencing. Its the challenge in which it talks about JSON and adding data into an array
devpaaji
@devpaaji
Jun 22 2016 06:59
~~
hhbh
~~
Markus Kiili
@Masd925
Jun 22 2016 07:00
@awbunys You just add a new object there so the structure is ...=[{...},{...}];
Faiz Ahmad Faiz
@Faizahmadfaiz
Jun 22 2016 07:00
@Masd925 True
devpaaji
@devpaaji
Jun 22 2016 07:00
@Masd925 i am trying to paste code
awbunys
@awbunys
Jun 22 2016 07:01
oh ok I was just using the wrong notations, thanks @Masd925
CamperBot
@camperbot
Jun 22 2016 07:01
awbunys sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1953 | @masd925 |http://www.freecodecamp.com/masd925
devpaaji
@devpaaji
Jun 22 2016 07:01
but it does not reflect
~~ code here
code here~~
Jon
@Antiphilous
Jun 22 2016 07:01
@imnotlammy upon looking at your code I don't think you are getting the right information from the json objedt
devpaaji
@devpaaji
Jun 22 2016 07:01
i am using symbol before 1 in keyboard
Lemmy
@imnotlammy
Jun 22 2016 07:02
@Antiphilous can you elaborate?
the first JSON or second one?
Jon
@Antiphilous
Jun 22 2016 07:03
@imnotlammy The second one where you are using the if statements
right now you are looking saying if data.stream == null
Lemmy
@imnotlammy
Jun 22 2016 07:03
$.getJSON(makeURL("streams", channel), function(data) {    
      if (data.stream === null) {
        status = "offline"
      }
      else if (data.stream === 422) {
        status = "account closed";
      }
      else if (data.stream === 404) {
        status = "error";
      }
      else {
        status = "online";
      };
    });
Jon
@Antiphilous
Jun 22 2016 07:03
put in a console log and take a look at the information you're getting back
Markus Kiili
@Masd925
Jun 22 2016 07:03
@awbunys One thing to note is that the FCC JSON challenges have very little to do with actual JSON, that is a text/string format for storing objects. Those challenges deal with javascript object literals (that can be written with syntax that could be used as a part of actual json text).
Jon
@Antiphilous
Jun 22 2016 07:04
$.getJSON(makeURL("streams", channel), function(data) {    
console.log(data);
      if (data.stream === null) {
        status = "offline"
      }
      else if (data.stream === 422) {
        status = "account closed";
      }
      else if (data.stream === 404) {
        status = "error";
      }
      else {
        status = "online";
      };
    });
Chris Cullen
@123xylem
Jun 22 2016 07:04
function checkCashRegister(price, cash, cid) {
var val;
  var cost=arguments[0];
  var money=arguments[1];
var till= arguments[2];
  var count=0;
  var arr=[];
  var change= money-cost;
 var tillCount=0;
  var chgCount=0;
var convertedTill=[];
  var jCount=0;

  var denoms = [0.01,0.05, 0.1, 0.25, 1, 5, 10, 20, 100];
for (var t = 0;t < till.length; t++) {
  till[t].push(denoms[t]);}

  if(change<0){
  change=Math.abs(change);}//this makes change positive if its negative value
else change=change;


  for(i=0; i<till.length;i++){
   count+=till[i][1];}
    if(change>count){ 
    return "Insufficient Funds";
// Make a count that totals till values. If change is more than till then say so

  }  else{
    var chgArr=[];
  for(j=till.length-1;j>=0;j--){  
    var amountOfType=till[j][1]/till[j][2];//How many of each coin do u have?
    till[j].push(amountOfType);


    while(change>chgCount&& till[j][1]>0 &&change!==chgCount ){// HOW DO I MAKE till[i][1]<=change NOT FAIL on while loop? I can use if but not sure how to use an if here??      
      change = Math.round(change * 100) / 100;

  if(till[j][1]<=change){
      chgCount+=till[j][2];  
      change-=till[j][2];
    jCount+=1;



    }
    else{j--;}}
        }  return chgArr;
  }
}
checkCashRegister(19, 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]]);
ANy1 know why this says 1 is undefined? It seems to work and not work at different change numbers... It works but the last thing I need to do is delete duplicates when it returns array.
Lemmy
@imnotlammy
Jun 22 2016 07:05
@Antiphilous works
awbunys
@awbunys
Jun 22 2016 07:05
@Masd925 okay, gotcha. Didnt even realize that, Im so new to this
Jon
@Antiphilous
Jun 22 2016 07:05
@imnotlammy what works?
Lemmy
@imnotlammy
Jun 22 2016 07:05
I can see the objects