These are chat archives for FreeCodeCamp/Help

24th
Aug 2017
Brianna
@brisourceful
Aug 24 2017 00:05
does anyone have any good examples or tutorials on using ternary operators?
@thekholm80 ^^
Gulsvi
@gulsvi
Aug 24 2017 00:10
@brisourceful I don't know if you'll find much more than what's on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator
They're fairly terse and should be avoided if you end up using ternaries within a ternary
Brianna
@brisourceful
Aug 24 2017 00:11
@SkyC0der my go to is MDN but I often don't like their examples.
Gulsvi
@gulsvi
Aug 24 2017 00:11
What is it about them that you need help with @brisourceful ?
condition ? expr1 : expr2
Brianna
@brisourceful
Aug 24 2017 00:11
I'm working on making my code a little more dry and I have an if statement that could be easily condensed into one line with a ternary but it keeps returning undefined.
Gulsvi
@gulsvi
Aug 24 2017 00:12
I'm happy to look at the code if it helps
just1witness
@just1witness
Aug 24 2017 00:13
@SkyC0der you could look at my code! :(
Gulsvi
@gulsvi
Aug 24 2017 00:13
// if the array length is 4, push the number 5, else return the array
return arr.length == 4 ? arr.push(5) : arr
just1witness
@just1witness
Aug 24 2017 00:13
oops, that was supposed to be a smily winky face, haha!
Gulsvi
@gulsvi
Aug 24 2017 00:13
@just1witness I could, but we'd be here all night lol. I haven't finished that one yet
just1witness
@just1witness
Aug 24 2017 00:13
not sad really
lol, ok
it's hard
Gulsvi
@gulsvi
Aug 24 2017 00:14
Yeah, it's one of 2 I have left
just1witness
@just1witness
Aug 24 2017 00:14
This is day two for me
Gulsvi
@gulsvi
Aug 24 2017 00:14
just finished no repeats please yesterday
just1witness
@just1witness
Aug 24 2017 00:14
nice, are you excited to be so close to the end?
Brianna
@brisourceful
Aug 24 2017 00:14
@SkyC0der hmmm I'm definitely over looking something
function solution(str, ending) {
  str.includes(ending) === true ? 'true' : 'false';
}
Gulsvi
@gulsvi
Aug 24 2017 00:15
@brisourceful For that, you just do
function solution(str, ending) {
  return str.includes(ending);
}
because .includes() returns true or false already
Brianna
@brisourceful
Aug 24 2017 00:16
oh duh! ugh I should have caught that
@SkyC0der thank you!
CamperBot
@camperbot
Aug 24 2017 00:16
brisourceful sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2549 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Aug 24 2017 00:16
No problem!
And, yeah @just1witness excited to be done with the algos for sure. I still have a lot to go with the front-end projects
procrastinated way too long on those
just1witness
@just1witness
Aug 24 2017 00:17
@SkyC0der Yeah, me too. I have the twitch.io and all 4 of the last projects left. Plus, I really should go back and update the ones I already did.
Gulsvi
@gulsvi
Aug 24 2017 00:18
@brisourceful I think it would have worked, despite the anti-pattern, if you returned true or false as boolean values rather than strings. (guessing)
Brianna
@brisourceful
Aug 24 2017 00:18
@SkyC0der I don't think it would since it was returning undefined when I didn't have them as strings.
Gulsvi
@gulsvi
Aug 24 2017 00:19
@brisourceful I'm guessing it was undefined because there's no return statement
function solution(str, ending) {
  return str.includes(ending) === true ? true : false;
}
Brianna
@brisourceful
Aug 24 2017 00:20
that's probably it
Brianna
@brisourceful
Aug 24 2017 00:30

@SkyC0der I'm working on a Code Wars challenge and only 1 of the 10 tests are failing. Can you enter this into your console or repl and see if the expected outcome is true or false?

function solution(str, ending) {
  str.toLowerCase;
  return str.includes(ending);
}

solution('samurai', 'ra')

Samurai is coming back on Code Wars as false but when I use repl.it returns true. wat!!!?

Gulsvi
@gulsvi
Aug 24 2017 00:32
@brisourceful This line needs some work: str.toLowerCase;
str = str.toLowerCase()
Brianna
@brisourceful
Aug 24 2017 00:32
opps forgot to invoke it
Gulsvi
@gulsvi
Aug 24 2017 00:32
Otherwise, I get true either way though
Manish Giri
@Manish-Giri
Aug 24 2017 00:33
@brisourceful maybe return str.toLowerCase().includes(...)
Brianna
@brisourceful
Aug 24 2017 00:33
ohhh yes very smart Manish
@Manish-Giri Thanks
Manish Giri
@Manish-Giri
Aug 24 2017 00:33
or maybe you should use .endsWith(), i'm not sure what the question is
CamperBot
@camperbot
Aug 24 2017 00:33
brisourceful sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6456 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Aug 24 2017 00:34
@brisourceful :+1:
Brianna
@brisourceful
Aug 24 2017 00:35
@Manish-Giri The question is: Complete the solution so that it returns true if the first argument(string) passed in ends with the 2nd argument (also a string).
Manish Giri
@Manish-Giri
Aug 24 2017 00:36
right, so note the "passed in ends with the 2nd argument" bit
Brianna
@brisourceful
Aug 24 2017 00:36
so yeah I probably should use .endsWith()
Manish Giri
@Manish-Giri
Aug 24 2017 00:36
.includes() would be true if the 2nd argument is anywhere in the string
not necessarily at the end..
Brianna
@brisourceful
Aug 24 2017 00:38
I missed that detail. Gracias!
Manish Giri
@Manish-Giri
Aug 24 2017 00:38
:smile: :+1:
Nick Ross
@codecampNick
Aug 24 2017 00:43
hi all, I’m doing the weather app and I’m seeing “11n” for the value of “icon”. I would have expected a url to an image. any ideas??
using the url provided (https://fcc-weather-api.glitch.me/api……..) and returning json
Albert Cardona II
@daddycardona
Aug 24 2017 00:49
link to your code @codecampNick
Nick Ross
@codecampNick
Aug 24 2017 00:50
LOL! right now it’s a total mess, just getting data but if you want to take a look….
https://codepen.io/codecampNick/pen/PKmoZg?editors=1111
thanks for any insight @daddycardona
CamperBot
@camperbot
Aug 24 2017 00:51
codecampnick sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 322 | @daddycardona |http://www.freecodecamp.com/daddycardona
Albert Cardona II
@daddycardona
Aug 24 2017 00:51
I see the image so what is wrong is something esle
Nick Ross
@codecampNick
Aug 24 2017 00:52
if you look at the json returned, the value of “icon” isn’t a url to an image. I have the image hard coded
"icon":"11n"
sheesh, now I’m seeing what I want
dang, I had this trouble a few days ago
Nick Ross
@codecampNick
Aug 24 2017 00:58
I guess all I need to do is ping you and it will magically start working!! :) Thanks for your time @daddycardona
CamperBot
@camperbot
Aug 24 2017 00:58
codecampnick sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:warning: codecampnick already gave daddycardona points
Albert Cardona II
@daddycardona
Aug 24 2017 00:58
LOL
that stuff happends but I don't know why you console.log('bla') and it showed up on the top of something
@codecampNick
Nick Ross
@codecampNick
Aug 24 2017 01:00
Just messing around. I was seeing where I was failing. Not too good at stepping through this yet. Way to used to VS
Albert Cardona II
@daddycardona
Aug 24 2017 01:00
no I understand that I am saying it is not logging in the console it is added to the top of the document can you see that?
Nick Ross
@codecampNick
Aug 24 2017 01:01
stand by……..
Albert Cardona II
@daddycardona
Aug 24 2017 01:01
blob
do you see the highlighted blah? it is suppose to be on the console so we have to check your js code
@codecampNick
Nick Ross
@codecampNick
Aug 24 2017 01:03
yeah, that is hardcoded in the div, the console.log “blah” is way at the top of what is returned i think
I kinda know what I want it to look like, but I’m not much of a designer.
the console is loging “blah” it’s just at the very top of the return
I’ll get it working like I want, just might take me a little longer than you speedy people! :smile:
Gersho
@Gersho
Aug 24 2017 01:07
it's not about making it fast, it's about understanding what you do
:wave: chatroom
Albert Cardona II
@daddycardona
Aug 24 2017 01:11
LOL never mind @codecampNick LOL I see you actually have it in the div too LOL and you are trying to do that on purpose lol
:wave: @Gersho
Nick Ross
@codecampNick
Aug 24 2017 01:12
:) yeah, “on purpose”…….
Gersho
@Gersho
Aug 24 2017 01:13
https://codepen.io/Gersho/pen/RZJPrZ
let me know about bugs or user stuff i've forgotten ! (design is not done yet)
Albert Cardona II
@daddycardona
Aug 24 2017 01:14
@codecampNick you should be setting the pic for the image like so $("#pic").attr('src',image);
not $(".pic").html(image);
just1witness
@just1witness
Aug 24 2017 01:15
@Gersho The first thing I see is that I would either wipe the screen or add an operator sign when the user presses an operator button.
Seems to calculate well , though :)
Any thoughts on my Simon Game?
Albert Cardona II
@daddycardona
Aug 24 2017 01:17
the difference is one the top one is setting it to the attribute of src in pic the other is trying to set what is written in like for instance, a div would use $(".pic").html('blah');in the actual document @codecampNick
stashe86
@stashe86
Aug 24 2017 01:17
I know of one bug already, when not on strict, spamming buttons makes it go all wonky.
Gersho
@Gersho
Aug 24 2017 01:17
@just1witness wipe the screen when clicking an operator ? i can't seem to replicate this issue
@stashe86 strict mode missing, if we stay afk, the game will keep spamming the current recorded melodu
melody
stashe86
@stashe86
Aug 24 2017 01:19
strict mode isn't missing. it's in the menu.
Gersho
@Gersho
Aug 24 2017 01:21
sorry :3
Albert Cardona II
@daddycardona
Aug 24 2017 01:21
@Gersho the calculator is nice I just compared it to windows calculater does it the same way :)
just1witness
@just1witness
Aug 24 2017 01:22
I it's not an issue per se, it has to do with flow. When you, say, input 3, then hit the + button, nothing happens, it makes it feel kind of buggy. But if you either cleared the screen or added the + sign, it would give user feedback and improve flow.
@Gersho
Gersho
@Gersho
Aug 24 2017 01:22
you can't input with keyboard on mine but that's on purpose @daddycardona
@just1witness hmm, i see what you mean, but isn't that how those old calculator worked ?
Nick Ross
@codecampNick
Aug 24 2017 01:23
Thanks @daddycardona
I appreciate you taking the time to help. I have some clean up and design work to do. The basic challenge is pretty good but I always try to do a little more than just meeting the AC
CamperBot
@camperbot
Aug 24 2017 01:23
codecampnick sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:warning: codecampnick already gave daddycardona points
just1witness
@just1witness
Aug 24 2017 01:23
It works great! Don't get me wrong it's awesome :) just a suggestion
@Gersho
stashe86
@stashe86
Aug 24 2017 01:23
I took out the time constraint for non-strict mode, but you have to hit the wrong button to have the pattern display again.
Gersho
@Gersho
Aug 24 2017 01:23
and suggestion are always welcome :)
just1witness
@just1witness
Aug 24 2017 01:24
:)
Gersho
@Gersho
Aug 24 2017 01:24
@stashe86 i don't own a simon game, didn't know they had a timer
Albert Cardona II
@daddycardona
Aug 24 2017 01:24
I understand I was like finish it and move on then I came back to most of them 100 times @codecampNick and it was my pleasure ;)
stashe86
@stashe86
Aug 24 2017 01:24
I'm pretty sure they do...
Gersho
@Gersho
Aug 24 2017 01:24
that would make sense i guess
Albert Cardona II
@daddycardona
Aug 24 2017 01:25
from what I can remember they do I use to own this memory game i loved it
after level 4 i sucked lol
Simon I love you LOL
stashe86
@stashe86
Aug 24 2017 01:26
Simon has taken me less time than I thought it would. I've been working on it a little bit at a time for a little less than a week now.
Gersho
@Gersho
Aug 24 2017 01:26
well you've done other projects before so know you go faster ^^
Joseph
@revisualize
Aug 24 2017 01:26
.... :wave:
Gersho
@Gersho
Aug 24 2017 01:27
did 90% of the calculator's JS in one sitting, simon took me ages
stashe86
@stashe86
Aug 24 2017 01:27
I was worried when I saw people saying they had been working on it for months/a year.
Gersho
@Gersho
Aug 24 2017 01:27
:wave:
Albert Cardona II
@daddycardona
Aug 24 2017 01:27
Wow I wish I still had it there was a milton bradly version that it came out first in and I had it in that version, then they had the cheaper hasbro version too
a week for @stashe86 and a long time for @Gersho I am screwed lol
well I am done for coding today see you all later :)
Gersho
@Gersho
Aug 24 2017 01:28
well when i started simon i didn't know of functions like settimeout or setinterval, and i tried to work around it...didn't end well
good day to you
stashe86
@stashe86
Aug 24 2017 01:29
I knew setInterval from the pomodoro timer
I think I've learned a lot about recursive functions doing the Simon Game.
just1witness
@just1witness
Aug 24 2017 01:41
Is there anyone here that can help me with an advanced algorithm?
Gersho
@Gersho
Aug 24 2017 01:42
show your problem, if we can help, we will :)
just1witness
@just1witness
Aug 24 2017 01:43
K, so yeah, I know this code is really bad and probably doesn't make a lot of sense, but even so I am SOOOO close to passing the test! (after I pass... if I pass, I will then watch a bunch of tutorials on it and learn how to do it right) This is my solo run through with my limited knowledge. So, the question is, now that I got it returning the correct format and only money values under the change that's due, how do I get it to return as many of each value that is needed equal the changeDue amount? I am assuming I would use % somehow, but i'm having trouble wrapping my mind around it. (on the plus side I get for loops now! :grinning: ) For instance changeDue = .50 returns one of each value under .50 , one quarter, one dime, one nickel, and one penny. How would I get it to return TWO quarters?
var monVal = [
    {value: 100.00},
    {value: 20.00},
    {value: 10.00},
    {value: 5.00},
    {value: 1.00},
    {value: 0.25},
    {value: 0.10},
    {value: 0.05},
    {value: 0.01},
  ];

  var monName = [
    {name: "ONE HUNDRED"},
    {name: "TWENTY"},
    {name: "TEN"},
    {name: "FIVE"},
    {name: "ONE"},
    {name: "QUARTER"},
    {name: "DIME"},
    {name: "NICKEL"},
    {name: "PENNY"},
  ];

function checkCashRegister(price, cash, cid) {
  var answer = [];
  var changeDue = (cash - price) * 100;
  var CID = (cid.reduce(function(acc,val){
    return acc+val[1]*100;
  },0));


  if (changeDue === CID) {
    return 'Closed';
  }
  if (changeDue > CID/100){
    return 'Insufficient Funds';
  }


  for (var i = 0; i < monVal.length; i++) {
    if(Object.values(monVal[i]) <= changeDue/100){
     answer.push(Object.values(monName[i]) + ", " + Object.values(monVal[i]));

    }
  }  
 return answer;  
}

checkCashRegister(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);
@Gersho
Gersho
@Gersho
Aug 24 2017 01:46
so the code is supposed to tell how much change you must give back, with details on which coin to give ?
feels a bit weird to choose to store it as 2 separate array, but as long as the data's here
just1witness
@just1witness
Aug 24 2017 01:47
Yeah, it pairs them based on their index
I tried with one array and one object, this was what I was able to get working marginally.
Raj Patel
@rajp1847
Aug 24 2017 01:48
hi
hi
h
i
hi
Gersho
@Gersho
Aug 24 2017 01:49
i probably would have used a 2 layer array = [ [100, one hundred],[20 etc...
just1witness
@just1witness
Aug 24 2017 01:49
It gives me one of each coin under the changeDue value, I can't get it to do more than one, like the roman numeral thing.
Gersho
@Gersho
Aug 24 2017 01:49
then make the loop based on the amount left of change to give
just1witness
@just1witness
Aug 24 2017 01:49
where it fills until it doesn't fit, then fills until it has no remainder
like store the value and make another loop? Does that mean I would have to have a bunch of loops for a large value?
Gersho
@Gersho
Aug 24 2017 01:50
while (money left){
if>100 -> add 100bill
else if>20->add 20 bill
etc etc
}
just1witness
@just1witness
Aug 24 2017 01:50
ohh, I see
Gersho
@Gersho
Aug 24 2017 01:51
the else should prevent giving smaller bills when earlier didn't trigger yet
just1witness
@just1witness
Aug 24 2017 01:51
let me give that a go, I'll let you know
Gersho
@Gersho
Aug 24 2017 01:51
\o/
go for it
just1witness
@just1witness
Aug 24 2017 01:52
:)
@Gersho thank you for helping me btw
CamperBot
@camperbot
Aug 24 2017 01:52
just1witness sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 349 | @gersho |http://www.freecodecamp.com/gersho
just1witness
@just1witness
Aug 24 2017 02:02
@Gersho This is how I wrote it, it says I created an infinate loop :/
 while (changeDue/100){
    if ( changeDue/100 >= 100){answer.push(Object.values(monName[0]) + ", " + Object.values(monVal[0]));
                              }
     else if ( changeDue/100 >= 20){answer.push(Object.values(monName[1]) + ", " + Object.values(monVal[1]));
                              }
    else if ( changeDue/100 >= 10){answer.push(Object.values(monName[2]) + ", " + Object.values(monVal[2]));
                              }
    else if ( changeDue/100 >= 5){answer.push(Object.values(monName[3]) + ", " + Object.values(monVal[3]));
                              }
    else if ( changeDue/100 >= 1){answer.push(Object.values(monName[4]) + ", " + Object.values(monVal[4]));
                              }
    else if ( changeDue/100 >= 0.25){answer.push(Object.values(monName[5]) + ", " + Object.values(monVal[5]));
                              }
    else if ( changeDue/100 >= 0.10){answer.push(Object.values(monName[6]) + ", " + Object.values(monVal[6]));
                              }
    else if ( changeDue/100 >= 0.05){answer.push(Object.values(monName[7]) + ", " + Object.values(monVal[7]));
                              }
    else if ( changeDue/100 >= 0.01){answer.push(Object.values(monName[8]) + ", " + Object.values(monVal[8]));
                              }

  }
Do I need to add breaks?
Gersho
@Gersho
Aug 24 2017 02:04
by the way looking at the challenge i noticed we're also supposed to take in account the quantity of change in the cash register
changeDue/100 won't that always be true ? also i don't see you substracting the change you give to the change you're still due to give
like if it's 60€ change, the cashier will give 50+50+50+50+etc etc
just1witness
@just1witness
Aug 24 2017 02:07
Is the lack of subtraction why it's an infinate loop? That makes sense.
Gersho
@Gersho
Aug 24 2017 02:08
if you don't subtract, there's always money to be given
plz comment
Gersho
@Gersho
Aug 24 2017 02:12
i see squares for most languages
messages
Raj Patel
@rajp1847
Aug 24 2017 02:12
who?
me?
yes @rajp1847
Raj Patel
@rajp1847
Aug 24 2017 02:13
that one failed
did u upload that?
Gersho
@Gersho
Aug 24 2017 02:14
no
Raj Patel
@rajp1847
Aug 24 2017 02:14
it was 11 sec ago
or 30 sec now
just1witness
@just1witness
Aug 24 2017 02:15
So I deleted the value from change due for each while loop cycle and it still says it's an infinite loop
 while (changeDue/100){
    if ( changeDue/100 >= 100){
      changeDue = changeDue - Object.values(monVal[0]);
    answer.push(Object.values(monName[0]) + ", " + Object.values(monVal[0])); 

                              }
     else if ( changeDue/100 >= 20){
       changeDue = changeDue - Object.values(monVal[1]);
     answer.push(Object.values(monName[1]) + ", " + Object.values(monVal[1]));

                              }
    else if ( changeDue/100 >= 10){
      changeDue = changeDue - Object.values(monVal[2]);
     answer.push(Object.values(monName[2]) + ", " + Object.values(monVal[2]));

                              }
    else if ( changeDue/100 >= 5){
      changeDue = changeDue - Object.values(monVal[3]);
     answer.push(Object.values(monName[3]) + ", " + Object.values(monVal[3]));

                              }
    else if ( changeDue/100 >= 1){
      changeDue = changeDue - Object.values(monVal[4]);
     answer.push(Object.values(monName[4]) + ", " + Object.values(monVal[4]));

                              }
    else if ( changeDue/100 >= 0.25){
      changeDue = changeDue - Object.values(monVal[5]);
     answer.push(Object.values(monName[5]) + ", " + Object.values(monVal[5]));

                              }
    else if ( changeDue/100 >= 0.10){
      changeDue = changeDue - Object.values(monVal[6]);
     answer.push(Object.values(monName[6]) + ", " + Object.values(monVal[6]));

                              }
    else if ( changeDue/100 >= 0.05){
      changeDue = changeDue - Object.values(monVal[7]);
     answer.push(Object.values(monName[7]) + ", " + Object.values(monVal[7]));

                              }
    else if ( changeDue/100 >= 0.01){
      changeDue = changeDue - Object.values(monVal[8]); 
     answer.push(Object.values(monName[8]) + ", " + Object.values(monVal[8]));

                              }

  }
Unless I'm subtracting it wrong
Raj Patel
@rajp1847
Aug 24 2017 02:15
yeaaaaa i kinda made the statment true and spamed stuff
just1witness
@just1witness
Aug 24 2017 02:15
wait, I think I am, give me a sec
Gersho
@Gersho
Aug 24 2017 02:17
you'll need to add checks to verify if the bill you want to give is still in stock (for ex: for 60€, you can't give 3x20 is there's only 2x20€ bills
just1witness
@just1witness
Aug 24 2017 02:21
Yeah, I'll have to do that once I figure this out. I figured I wasn't subtracting it right since I didn't divide changeDue by 100, but it still says it's an infinite loop
I figure out why
can't*
Gersho
@Gersho
Aug 24 2017 02:24
dunno either
just1witness
@just1witness
Aug 24 2017 02:27
I think by the time I figure this out, it will be 200 lines! haha!
Ginger
@GingerChew
Aug 24 2017 02:48
can I get some help with this arguments optional campfire? It's really stumping me
function addTogether() {
  var arg = 0; 
  var sumTwoAnd = addTogether(arguments[0]);
  for (var i in arguments) {
    if (typeof arguments[i] == 'string') {
      return undefined;
    } else if (arguments.length<2) {

    } else if (typeof arguments[i] == 'number') {
      arg += arguments[i];
    }
  }
  sumTwoAnd(arguments[1]);
  return arg;
}
when given two arguments (ie (2)(3) ) it should return a variable function that lets it process the second one?
I don't know if I'm explaining that right
Josebuendia
@Josebuendia
Aug 24 2017 02:53
Add a submit button to a form: <button type=Submit>Submit</button>
</form>
What's wrong with it?
Sam Goldberg
@sgoldber61
Aug 24 2017 03:25
@GingerChew Hi Ginger, you should probably look at the if/else logic regarding arguments.length before proceeding into a for loop.
well, if/else logic including possible non-number values. I would first check arguments for non-number values, then, after that, look at the possible values for arguments.length and figure out the right stuff to return from there. Does that outline make sense?
Sunny Wong
@swong194
Aug 24 2017 03:34
hi
does anybody here use repl?
if so do u know how to delete a classroom?
Mike Batista
@mbmontana
Aug 24 2017 03:40
Checking for Palindromes challenge. I at least got this to where it's return true/false instead of errors, but some of the falses should be true. Any hints about what I'm doing wrong?
function palindrome(str) {
var subString;
 subString = str.replace(/[^a-z0-9+]+/gi, '').toLowerCase();
 if (str == subString.split('').reverse().join(''))


{return true;}
  return false;
}



palindrome("My age is 0, 0 si ega ym.");
Gersho
@Gersho
Aug 24 2017 03:44
you should check which ones are wrong, you'll probably notice some trend (all having dots, or exclamation mark, etc)
Mike Batista
@mbmontana
Aug 24 2017 03:56
@Gersho Actually the only one to returns correctly is "eye" That's the only one without a space. Is a space considered a non-alphanumeric character?
Gersho
@Gersho
Aug 24 2017 03:56
it's a character for sure, dunno what type
Mike Batista
@mbmontana
Aug 24 2017 04:09
@Gersho I've replaced ([^a-z0-9+]+/gi, '') with (/\w/gi, '') and it still doesn't work.
Gersho
@Gersho
Aug 24 2017 04:10
have you tried console.log to check what your data looks like ?
Mike Batista
@mbmontana
Aug 24 2017 04:11
@Gersho I'm still foggy on how console.log works. What exactly should I console.log?
Gersho
@Gersho
Aug 24 2017 04:13
right before the if i'd console.log(str) and console.log(subString.split('').reverse().join(''))
and if it doesn't make sense do the same for subString too
Mike Batista
@mbmontana
Aug 24 2017 04:15
@Gersho For the first two I got nothing. It's supposed to show up in the black screen on the left, right?
Gersho
@Gersho
Aug 24 2017 04:15
in console.log(blabla) you can put commands like you usualy would, great for checking variables (var x=0; console.log(x) // shows 0 in log
oh wait it's true it's fcc's challenge page, wait a min
Mike Batista
@mbmontana
Aug 24 2017 04:16
@Gersho do i need to go to developer tools?
Gersho
@Gersho
Aug 24 2017 04:16
you'll need to press F12 and check the console tab
but since it does a bunch of test too you're gonna see the results for each solution they check
Mike Batista
@mbmontana
Aug 24 2017 04:21
@Gersho I'm getting a lot of "subString is not defined"
Gersho
@Gersho
Aug 24 2017 04:23
did you put the console.log after declaring substring ?
Mike Batista
@mbmontana
Aug 24 2017 04:25
@Gersho There's so much stuff in the console log it's hard for me to follow.
Gersho
@Gersho
Aug 24 2017 04:30
sorry i'm a bit out of idea :3
Mike Batista
@mbmontana
Aug 24 2017 05:02
@Gersho I had to get it off a YouTube video because I gotta go to sleep. I just needed to declare more variables.
Tim
@Genjack
Aug 24 2017 06:07
hullo, I have a quick question about bootstrap and my codepen if anyone is interested?
or if anyone's here even
Tyler Furby
@tyler-furby
Aug 24 2017 08:04
I have a question, on the drop it challenge, why on earth should this dropElements([0, 1, 0, 1], function(n) {return n === 1;}); ever return [1, 0, 1]? Wouldn’t the correct answer be [1,1]?
Because this should be the correct solution:
function dropElements(arr, func) {
  // Drop them elements.
  var dropIt = arr.filter(function(number){
    return func(number);
  });
  return dropIt;
}
yingyinghou
@yingyinghou
Aug 24 2017 08:13
I have a question
yingyinghou
@yingyinghou
Aug 24 2017 08:24
How did the interface become this way why to become a chat interface, how to go back
Priyan Siva
@PriyanSiva
Aug 24 2017 08:30
how to split string by single characters
Gulsvi
@gulsvi
Aug 24 2017 08:36
str.split('') @PriyanSiva
Priyan Siva
@PriyanSiva
Aug 24 2017 08:37
@SkyC0der thanks man
CamperBot
@camperbot
Aug 24 2017 08:37
priyansiva sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2553 | @skyc0der |http://www.freecodecamp.com/skyc0der
heroiczero
@heroiczero
Aug 24 2017 08:38
@tyler-furby Drop until it return true and then stop dropping. Currently you are dropping anything that is not func
Tyler Furby
@tyler-furby
Aug 24 2017 08:39
Ah. Thanks @heroiczero
CamperBot
@camperbot
Aug 24 2017 08:39
tyler-furby sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1644 | @heroiczero |http://www.freecodecamp.com/heroiczero
Priyan Siva
@PriyanSiva
Aug 24 2017 08:57
How do I multiply all the numbers in an array
heroiczero
@heroiczero
Aug 24 2017 08:58
@PriyanSiva you can use .map
Gulsvi
@gulsvi
Aug 24 2017 08:59
@PriyanSiva you can use .reduce()
var array = [2, 3, 4];
var product = array.reduce(function(a,b) {
  return a * b;
});
console.log(product); // 24
same as adding all numbers of an array, only replace + with *
I'd like to see your .map solution @heroiczero too
var array = [2, 3, 4];
var product = 1;
for(var i = 0; i < array.length; i++) {
  product *= array[i]
}
console.log(product);
for loop is also good
shumindong
@shumindong
Aug 24 2017 09:02
请问如何把文本框套进FORM元素中?
Gulsvi
@gulsvi
Aug 24 2017 09:03
hai
shumindong
@shumindong
Aug 24 2017 09:04
can you help me ,please?
heroiczero
@heroiczero
Aug 24 2017 09:04
const arr=[2,3,4];
let product=1;
return arr.map( (x) => product*=x)[arr.length-1];
Gulsvi
@gulsvi
Aug 24 2017 09:04
@shumindong
<form>
  <input type="text">
</form>
@heroiczero that returns [0, 0, 0]
heroiczero
@heroiczero
Aug 24 2017 09:08
sorry kinda tired fixed it
shumindong
@shumindong
Aug 24 2017 09:10
how to Send photo here?
heroiczero
@heroiczero
Aug 24 2017 09:11
@shumindong click and drag into the message box
Josebuendia
@Josebuendia
Aug 24 2017 11:30

<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}

.smaller-image {
width: 100px;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p>Click here for <a href="#">cat photos</a>.</p>

<a href="#"><img class="smaller-image thick-green-border" alt="A cute orange cat lying on its back. " src="https://bit.ly/fcc-relaxing-cat"></a>

<div .silver-background { background-color: silver;} }>
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
</div>

<form action="/submit-cat-photo">
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
Where am I going wrong with this 'giving a background color to a div element?

Stephen James
@sjames1958gm
Aug 24 2017 11:48
@Josebuendia
You need to give your div a class="silver-background"
Move that style definition to the <style> section
Josebuendia
@Josebuendia
Aug 24 2017 11:56
@sjames1958gm what do you mean by 'move the style definition?
Stephen James
@sjames1958gm
Aug 24 2017 11:57
@Josebuendia .silver-background { background-color: silver;} this should be in the <style></style> tags above
Josebuendia
@Josebuendia
Aug 24 2017 12:01

<style>
div class=.silver-background {
background-color: silver;
}
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}

.smaller-image {
width: 100px;
}
</style>

<h2 class="red-text">CatPhotoApp<

still didn't work
@sjames1958gm
korzo
@korzo
Aug 24 2017 12:03
@Josebuendia instead div class=.silver-background it should be .silver-background
Josebuendia
@Josebuendia
Aug 24 2017 12:06
@korzo @sjames1958gm thanks!
CamperBot
@camperbot
Aug 24 2017 12:06
josebuendia sends brownie points to @korzo and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 406 | @korzo |http://www.freecodecamp.com/korzo
:star2: 8376 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Rajan
@ProgramNovice
Aug 24 2017 12:17
Hi guys
I have a doubt about div element
is it something similar to a function which contains a few lines of code?
Stephen James
@sjames1958gm
Aug 24 2017 12:24
@ProgramNovice a div is just a HTML container element, functions really don't apply to HTML.
HTML describes document structure not code execution.
Rajan
@ProgramNovice
Aug 24 2017 12:26
@sjames1958gm Oh ok thanks :). I would like to check with you whether the following explanation of div element is correct (I read it in a forum)
The purpose of div element is so that, they can hold a block of code And control the structure, space, width, layout of a given object as per your desire.
CamperBot
@camperbot
Aug 24 2017 12:26
programnovice sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8377 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Nicol
@NicolNonga
Aug 24 2017 12:29
hlep me please with Wherefore art thou
here is my code

unction whatIsInAName(collection, source) {
// What's in a name?
var arr = [];
// Only change code below this line

var correctkey;

for(var j in source){

for(var i in collection)

 if(collection.hasOwnProperty(i)){


  correctkey=  collection[i];


   arr.push(correctkey);
 }

}

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

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });

korzo
@korzo
Aug 24 2017 12:40
@NicolNonga You have to loop over source, not collection.
then check, if the same key is also in collection and if not, return false.
After the loop, return true
Nicol
@NicolNonga
Aug 24 2017 12:47
@korzo it is return an empty string
empty array
Stephen James
@sjames1958gm
Aug 24 2017 12:48
@ProgramNovice I would term code as a loose definition of what HTML is. I think of code as javascript.
a div element can hold a block of HTML and control the structure, space, width, layout of a given object as per your desire.
Rajan
@ProgramNovice
Aug 24 2017 12:49
@sjames1958gm Ok thansk alot Stephen :)
thanks*
Stephen James
@sjames1958gm
Aug 24 2017 12:49
@NicolNonga You primary loop should be over collection, since you want to choose which collection items to keep or discard.
Then for each collection item, loop over source and check the current collection item.
@ProgramNovice :+1:
Josebuendia
@Josebuendia
Aug 24 2017 13:11

</div>

<form action="/submit-cat-photo" id="cat-photo-form" #cat-photo-element{ background-color: green; }>

What's wrong with this? (use an ID to style an element)
Sorin Ruse
@sorinr
Aug 24 2017 13:14
@Josebuendia #cat-photo-element{ background-color: green; } this should be in css part or between <style></style> tags
Stephen James
@sjames1958gm
Aug 24 2017 13:14
@Josebuendia Put the css in the <style></style> tags.
@Josebuendia And the id is #cat-photo-form not #cat-photo-element
Sritharini
@srithpink
Aug 24 2017 13:27
hi all :smile:
i need a help on one of hackerrank's algorithms question
can anyone hlp me please?
Alexsen
@rahimelhaj
Aug 24 2017 13:35
I have a question in Java, am I in the right place??? :D
Stephen James
@sjames1958gm
Aug 24 2017 13:37
@rahimelhaj This is for javascript - java is a different language
@srithpink Ask a specific question about it and someone is sure to answer
Alexsen
@rahimelhaj
Aug 24 2017 13:38
@sjames1958gm I know for sure, but I thought someone might be a java programmer, and ready to help.
Stephen James
@sjames1958gm
Aug 24 2017 13:51
@rahimelhaj Give it a try - someone may be able to help - it seems pretty quiet now
Josebuendia
@Josebuendia
Aug 24 2017 14:50

<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}

.smaller-image {
width: 100px;
}

.silver-background {
background-color: silver;
}
<form action="/submit-cat-photo" id="cat-photo-form" #cat-photo-form{ background-color: green; }>
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p>Click here for <a href="#">cat photos</a>.</p>

<a href="#"><img class="smaller-image thick-green-border" alt="A cute orange cat lying on its back. " src="https://bit.ly/fcc-relaxing-cat"></a>

<div class="silver-background">
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
</div>
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>

like that?
@sjames1958gm
Stephen James
@sjames1958gm
Aug 24 2017 14:51
yes, but put the css in the <style></style> element like you did with .silver-background
#cat-photo-form{ 
background-color: green; 
}
xlf655
@xlf655
Aug 24 2017 14:53
image.png
hello everyone i dont know what's wrong with it
Darren
@DarrenfJ
Aug 24 2017 14:56
morning fCC
@xlf655 your probably going to need someone who can read that
@xlf655 there used to be rooms that handled other languages.. not sure if they are still active though
@xlf655 thisi the list of rooms, and it looks like there's still a few in there
@ravikishorethella hey buddy :d we keep missing each other
xlf655
@xlf655
Aug 24 2017 15:00
@DarrenfJ sorrt i just click "help" and join this
Josebuendia
@Josebuendia
Aug 24 2017 15:03
So move <form action="/submit-cat-photo" id="cat-photo-form"> into the style element?
Darren
@DarrenfJ
Aug 24 2017 15:04
@xlf655 oh no worries man, it's just that this is mostly volunteers here so your chances of getting someone who can read your native language is based on whoever is randomly in here...
@xlf655 whereas if you go to on e of the fCC rooms that are language based you might find someone who can answer your question...
@xlf655 I can probably answer it for that exercise.. just can;t verify in your code if what you did is correct...
@xlf655 what wasn't working for you?
@Josebuendia that part should stay in the html (below the style tags)
Stephen James
@sjames1958gm
Aug 24 2017 15:07
@Josebuendia No just the style that you added
Darren
@DarrenfJ
Aug 24 2017 15:07
@sjames1958gm oh hey buddy!
Stephen James
@sjames1958gm
Aug 24 2017 15:07
@Josebuendia Just the css that I showed above.
Darren
@DarrenfJ
Aug 24 2017 15:07
yer in good hands ;) @Josebuendia
Stephen James
@sjames1958gm
Aug 24 2017 15:07
@DarrenfJ :wave:
Darren
@DarrenfJ
Aug 24 2017 15:07
:D
imma go back to lurking
Stephen James
@sjames1958gm
Aug 24 2017 15:10
Here's a tree to hide behind :palm_tree:
Darren
@DarrenfJ
Aug 24 2017 15:10
thanks @sjames1958gm :D
CamperBot
@camperbot
Aug 24 2017 15:10
darrenfj sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8380 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Darren
@DarrenfJ
Aug 24 2017 15:12
@sjames1958gm whenever i used to visit San Fran i got a kick outta this guy: hiding behind a tree
Stephen James
@sjames1958gm
Aug 24 2017 15:12
@DarrenfJ lol
Josebuendia
@Josebuendia
Aug 24 2017 15:13
thanks
@sjames1958gm
xlf655
@xlf655
Aug 24 2017 15:13
@DarrenfJ thank you got it
CamperBot
@camperbot
Aug 24 2017 15:13
xlf655 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1986 | @darrenfj |http://www.freecodecamp.com/darrenfj
Darren
@DarrenfJ
Aug 24 2017 15:15
@xlf655 ah you got it figured out? cool!
virtual high five
nothing like figuring it out yerself ;)
Josebuendia
@Josebuendia
Aug 24 2017 15:17
This stuff just comes through practice of FreeCodeCamp or do I need to research in depth theory? When I get stuff right I'm not always sure why I get it right.
Darren
@DarrenfJ
Aug 24 2017 15:17
practice helps... you get more familiar with the syntax....
Darren
@DarrenfJ
Aug 24 2017 15:24
you'll earn a lot doing the fCC projects as well.. and that will act like a veeery deep dive ;)
ok gotta go back to RL and test... codeOn roomies :D
Ken Haduch
@khaduch
Aug 24 2017 15:26
@Josebuendia - practice and research are both necessary. If you "accidentally" get something to work and don't understand it, you can always post a question and your code and people will be happy to explain. Much better to have code and specific questions, you can get a better response.
Rishabh Kashyap
@iamrkcheers
Aug 24 2017 15:26
how much time wd it take to complete the dungeon crawler game in react projects.
(estimated time
Ken Haduch
@khaduch
Aug 24 2017 15:37
@iamrkcheers - I haven't gotten there, yet... It doesn't seem like too many people are active in the room at this point?
Kyle Holm
@thekholm80
Aug 24 2017 15:54
@iamrkcheers i spent about 8 or 9 days on mine
Ishtmeet Singh
@IshtmeetSinghRissam
Aug 24 2017 15:56
@thekholm80 hey kyle ;)
Kyle Holm
@thekholm80
Aug 24 2017 15:57
@IshtmeetSinghRissam hey Ishtmeet! long time no see
how's your chat program coming along?
Ishtmeet Singh
@IshtmeetSinghRissam
Aug 24 2017 15:58
Hey
@thekholm80 i just finished it, and worked on canvas a biy mre
bit more
Kyle Holm
@thekholm80
Aug 24 2017 15:59
oh, very cool
i really like canvas
Ishtmeet Singh
@IshtmeetSinghRissam
Aug 24 2017 15:59
check this
my implementation of particlejs
the radius seems quite big, should decrease (for the attraction), looks nice on big window though
it's 60
@thekholm80 any feedback would be cool ;)
Kyle Holm
@thekholm80
Aug 24 2017 16:00
that looks awesome
Ishtmeet Singh
@IshtmeetSinghRissam
Aug 24 2017 16:01
due to black background, some balls are generated in black color
so can't see those
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:23
helloou
Kyle Holm
@thekholm80
Aug 24 2017 16:24
@NahuelOvejero :wave:
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:25
@thekholm80 hello my friend! how is everything going for you?
Kyle Holm
@thekholm80
Aug 24 2017 16:25
not bad, how about you? any luck with the job hunt?
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:27
not really, no new offers in my zone, I hope they appears as much as the "hot single russian ladys on yout town"
:P
Was trying to apply to remote, but people over 3+ years was also applying, so no real chance
And the ones who want to hire me, just keep passing the date of the interview, wwek by week, so they aren't desesperate I think :P
Kyle Holm
@thekholm80
Aug 24 2017 16:28
that sucks
can you do any upwork or something like that?
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:30
yeah, finding a job is harder than I've experienced before , its a small city to , I'm thinking in travel ASAP
Kyle Holm
@thekholm80
Aug 24 2017 16:30
come to America
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:30
I tried, a few of freelancer, I even tried to work with no fee, but never won lol
I would love to, my objective is work in USA / Europa in the next years
Kyle Holm
@thekholm80
Aug 24 2017 16:31
that would be cool
Sorin Ruse
@sorinr
Aug 24 2017 16:31
don't sell ur soul for nothing
Kyle Holm
@thekholm80
Aug 24 2017 16:32
google tells me Lima, Peru is an awesome place for tech jobs, and a bunch of cities in Brazil
but Brazil speaks Portuguese?
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:32
Indeed
TheTomboySarah
@TheTomboySarah
Aug 24 2017 16:32
image.png
can someone tell me where im wrong here?
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:32
well, Buenos Aires isn't that bad neither
but I live 12 hours in bus
Kyle Holm
@thekholm80
Aug 24 2017 16:32
Buenos Aires was 8th on the list
Lima, Peru. ...
Belo Horizonte, Brazil. ...
Rio de Janeiro, Brazil. ...
Campinas, Brazil. ...
São Paulo, Brazil. ...
Curitiba, Brazil. ...
Santiago, Chile. ...
Buenos Aires, Argentina.
Stephen James
@sjames1958gm
Aug 24 2017 16:33
@TheTomboySarah Looks like you removed the id="target1" from the element
Sorin Ruse
@sorinr
Aug 24 2017 16:33
yep. but relocation has its own costs
Albert Cardona II
@daddycardona
Aug 24 2017 16:33
Boston Massachusetss
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:33
@TheTomboySarah check your target 1 id inside the wells
Albert Cardona II
@daddycardona
Aug 24 2017 16:33
good for tech jobs
Kyle Holm
@thekholm80
Aug 24 2017 16:34
Boston is full of Yanks
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:34
@thekholm80 never thoguth that Peru was the number 1, lol , interesting
Albert Cardona II
@daddycardona
Aug 24 2017 16:34
and they have a bunch of spaish speaking people
TheTomboySarah
@TheTomboySarah
Aug 24 2017 16:34
thank you so much! how did i not spot that!
Kyle Holm
@thekholm80
Aug 24 2017 16:34
@NahuelOvejero it says it's ordered north to south lol
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:34
lmao
that explains my confusion
Albert Cardona II
@daddycardona
Aug 24 2017 16:35
On top of that you could live in Westboro where the population is like 86% people form India
from
Kyle Holm
@thekholm80
Aug 24 2017 16:35
I want to just live in India
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:36
I don't have any prejuices / problem working with anyone, as long they respect everyone
why Kyle?
Kyle Holm
@thekholm80
Aug 24 2017 16:36
Why India? low cost of living, excellent food
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:37
So, you do like Spicy I guess hahaha
Kyle Holm
@thekholm80
Aug 24 2017 16:37
yes, yes i do
Albert Cardona II
@daddycardona
Aug 24 2017 16:37
Yes that is good because the people in westboro ma all work a lot and most of them in some tech field like programming and computer engineer
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:38
something like Scillycon Valley :P
Someone know about GeneXus?
Albert Cardona II
@daddycardona
Aug 24 2017 16:40
heard about it @NahuelOvejero
Now I am still stuck on this wherefore are thou I thought I had it
Kyle Holm
@thekholm80
Aug 24 2017 16:46
are you using Object.keys()?
Sergey Likhashorskiy
@lihash
Aug 24 2017 16:50
https://codepen.io/Lihash/full/xLzYMg/ WebGL// Tribute to Elon Musk. How does my tribute page look? Play with background and have fun =)
Albert Cardona II
@daddycardona
Aug 24 2017 16:53
@thekholm80 yes I am I just think I need a different approach I got the first 2 requirements for it good to go but he second 2 no boo me lol
Kyle Holm
@thekholm80
Aug 24 2017 16:54
quite often i'll get locked into one way of doing something and keep banging my head when there's often a simpler solution i've never even considered
but i'm not very bright
Nahuel Ovejero
@NahuelOvejero
Aug 24 2017 16:56
code katas have show me how stupid I am :D or genious is other people
Kyle Holm
@thekholm80
Aug 24 2017 16:56
i've been slacking on the katas
i've been slacking on all of it lol
Albert Cardona II
@daddycardona
Aug 24 2017 16:56
@lihash that is an awesome tribute page
@thekholm80 yes me too, I am trying to learn filter and each methods and how to properly use it for functions like what I am doing but I am a simpleton and don't seem to understand them lol
Kyle Holm
@thekholm80
Aug 24 2017 16:58
the higher order methods took me a while to get the hang of
especially reduce and map
Albert Cardona II
@daddycardona
Aug 24 2017 16:59
if I got a hang of those this code would of been done and it would have been simpler and less code. I am like margaret I like less code to do more however I am not like margaret in actually coding lol
Kyle Holm
@thekholm80
Aug 24 2017 17:00
it looks like i used filter(), every() and Object.keys() to do that one
were i to do it again i'd probably do it differently though
just1witness
@just1witness
Aug 24 2017 17:01
Can anyone see why this is saying cid[3] is undefined?
var monVal = [
    {value: 10000},
    {value: 2000},
    {value: 1000},
    {value: 500},
    {value: 100},
    {value: 25},
    {value: 10},
    {value: 5},
    {value: 1},
  ];

  var monName = [
    {name: "ONE HUNDRED"},
    {name: "TWENTY"},
    {name: "TEN"},
    {name: "FIVE"},
    {name: "ONE"},
    {name: "QUARTER"},
    {name: "DIME"},
    {name: "NICKEL"},
    {name: "PENNY"},
  ];

function checkCashRegister(price, cash, cid) {
  var answer = [];
  var changeDue = (cash - price) * 100;
  var CID = (cid.reduce(function(acc,val){
    return acc+val[1]*100;
  },0));


  if (changeDue === CID) {
    return 'Closed';
  }
  if (changeDue > CID){
    return 'Insufficient Funds';
  }



 while (changeDue > 0){
    if ( changeDue >= 10000 && cid[8][1] * 100 >= 10000){
      cid = cid[8][1] * 100 - 10000;
      changeDue = changeDue - Object.values(monVal[0]);
     answer.push(Object.values(monName[0]) + ", " + Object.values(monVal[0])/100); 

                              }
     else if ( changeDue >= 2000 && cid[7][1] * 100 >= 2000){
       cid = cid[7][1] * 100 - 2000;
       changeDue = changeDue - Object.values(monVal[1]);
     answer.push(Object.values(monName[1]) + ", " + Object.values(monVal[1])/100);

                              }
    else if ( changeDue >= 1000 && cid[6][1] * 100 >= 1000){
      cid = cid[6][1] * 100 - 100;
      changeDue = changeDue - Object.values(monVal[2]);
     answer.push(Object.values(monName[2]) + ", " + Object.values(monVal[2])/100);

                              }
    else if ( changeDue >= 500 && cid[5][1] * 100 >= 500){
      cid = cid[5][1] * 100 - 500;
      changeDue = changeDue - Object.values(monVal[3]);
     answer.push(Object.values(monName[3]) + ", " + Object.values(monVal[3])/100);

                              }
    else if ( changeDue >= 100 && cid[4][1] * 100 >= 100){
      cid = cid[4][1] * 100 - 100;
      changeDue = changeDue - Object.values(monVal[4]);
     answer.push(Object.values(monName[4]) + ", " + Object.values(monVal[4])/100);

                              }
    else if ( changeDue >= 25 && cid[3][1] * 100 >= 25){
      cid = cid[3][1] * 100 - 25;
      changeDue = changeDue - Object.values(monVal[5]);
     answer.push(Object.values(monName[5]) + ", " + Object.values(monVal[5])/100);

                              }
    else if ( changeDue >= 10 && cid[2][1]* 100 >= 10){
      cid = cid[2][1] * 100 - 10;
      changeDue = changeDue - Object.values(monVal[6]);
     answer.push(Object.values(monName[6]) + ", " + Object.values(monVal[6])/100);

                              }
    else if ( changeDue >= 5 && cid[1][1] * 100 >= 5){
      cid = cid[1][1] * 100 - 5;
      changeDue = changeDue - Object.values(monVal[7]);
     answer.push(Object.values(monName[7]) + ", " + Object.values(monVal[7])/100);

                              }
    else if ( changeDue >= 1 && cid[0][1] * 100 >= 1){
      cid = cid[0][1] * 100 - 1;
      changeDue = changeDue - Object.values(monVal[8]); 
     answer.push(Object.values(monName[8]) + ", " + Object.values(monVal[8])/100);

                              }

  } 




 return answer;
}

checkCashRegister(19.50, 20.00, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0.50], ["ONE", 1.00], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]);
Albert Cardona II
@daddycardona
Aug 24 2017 17:01
function whatIsInAName(collection, source) {
    // What's in a name?
    var arr = [];
    // Only change code below this line
    var sourceKeys = Object.keys(source);
    var sourceVals = Object.values(source);
    for (var i = 0; i < collection.length; i++) {

        for (var j = 0; j < sourceKeys.length; j++) {
            if (collection[i].hasOwnProperty(sourceKeys[j])) {
                if (collection[i][sourceKeys[j]] === sourceVals[j]) {
                    arr.push(collection[i]);
                }

            }
        }
    }

    console.dir(arr);
    // Only change code above this line
    return 'arr';

}
yet this is what I have
just1witness
@just1witness
Aug 24 2017 17:04
Apparently all of the cid[x] are returning undefined, but only after I add the line cid = cid[6][1] 100 - 100;. Before that else if ( changeDue >= 1 && cid[0][1] 100 >= 1) doesn't come back as undefined.
Rishabh Kashyap
@iamrkcheers
Aug 24 2017 17:05
I am at the FCC Data Visualisation -> React Projects -> Recipe Box.
I am having a syntax error on line 86 of my code as follows, 'Invalid regular expression: missing /'.
However, I cannot seem to determine as to why it is showing the aforementioned error.
https://codepen.io/iamrkcheers/pen/WEKjQz?editors=0010
Thank You.
Sergey Likhashorskiy
@lihash
Aug 24 2017 17:08
@daddycardona thanks for the support!
CamperBot
@camperbot
Aug 24 2017 17:08
lihash sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 323 | @daddycardona |http://www.freecodecamp.com/daddycardona
Albert Cardona II
@daddycardona
Aug 24 2017 17:09
@lihash I like how you can play with the background however how was it that you were able to use a background image like that without url?
Sergey Likhashorskiy
@lihash
Aug 24 2017 17:13
@daddycardona I`m used const TEXTURE_PATH = 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/123879/';
just1witness
@just1witness
Aug 24 2017 17:13
nvm, I figured it out. I wasn't declaring the index to change when trying to change cid at a certain index.... duh :)
Albert Cardona II
@daddycardona
Aug 24 2017 17:14
Oh that is awesome and then you were able to set an area to play with it @lihash
@just1witness I was still looking at your code but couldn't figure it out glad you did
Stephen James
@sjames1958gm
Aug 24 2017 17:15
@iamrkcheers Looks like the code doesn't understand JSX
just1witness
@just1witness
Aug 24 2017 17:15
@daddycardona Thank you :)
CamperBot
@camperbot
Aug 24 2017 17:15
just1witness sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 324 | @daddycardona |http://www.freecodecamp.com/daddycardona
Albert Cardona II
@daddycardona
Aug 24 2017 17:15
no problem
@just1witness sometimes I take my code out of places and use them in vscode an editor sometimes it makes it easier for me
Rishabh Kashyap
@iamrkcheers
Aug 24 2017 17:16
@sjames1958gm what the hell. what to do.
Stephen James
@sjames1958gm
Aug 24 2017 17:16
@iamrkcheers Hmm, not sure
just1witness
@just1witness
Aug 24 2017 17:17
@daddycardona It is supposed to look like this cid[8][1] = cid[8][1] 100 - 10000;, not cid= cid[8][1] 100 - 10000;. That's what I was missing
Albert Cardona II
@daddycardona
Aug 24 2017 17:17
@thekholm80 You probably do it in one line lol
Kyle Holm
@thekholm80
Aug 24 2017 17:17
@daddycardona oh, i don't think i could do that one in a single line
Stephen James
@sjames1958gm
Aug 24 2017 17:17
@iamrkcheers Odd that it is way down at that line
Albert Cardona II
@daddycardona
Aug 24 2017 17:17
Oh okay I see that now @just1witness thanks for sharing great job and I am not looking for challenge lol
CamperBot
@camperbot
Aug 24 2017 17:17
daddycardona sends brownie points to @just1witness :sparkles: :thumbsup: :sparkles:
:cookie: 292 | @just1witness |http://www.freecodecamp.com/just1witness
just1witness
@just1witness
Aug 24 2017 17:18
:) my pleasure
Stephen James
@sjames1958gm
Aug 24 2017 17:18
@iamrkcheers The compiled version shouldn't show any JSX ??
Rishabh Kashyap
@iamrkcheers
Aug 24 2017 17:19
@sjames1958gm got it.
A JSX expression must have exctly 1 outer element ie opening and closing tags in a JSX parenthesis must be same.
Albert Cardona II
@daddycardona
Aug 24 2017 17:19
@thekholm80 oh so did you see my code which works for the first 2 tests but then they got it more difficult and it don't work for the last 2 test
Stephen James
@sjames1958gm
Aug 24 2017 17:19
@iamrkcheers Ah, good catch
@iamrkcheers Not a useful error message :(
Kyle Holm
@thekholm80
Aug 24 2017 17:21
@daddycardona keep at it, you'll get it
Albert Cardona II
@daddycardona
Aug 24 2017 17:22
yeah I was creating a web page yesterday and the day before finaly got what i needed on it so now I am back to this and had it so every is what i need why did i think i need each?
@thekholm80 so should I be linking reduce.every()
Kyle Holm
@thekholm80
Aug 24 2017 17:23
i'm not sure reduce is good here since it only returns a single value
Stephen James
@sjames1958gm
Aug 24 2017 17:23
@daddycardona Array .every is useful for this challenge
Albert Cardona II
@daddycardona
Aug 24 2017 17:23
I am trying to make this simple but I think I need to hand write
Stephen James
@sjames1958gm
Aug 24 2017 17:23
@daddycardona Just realize you have to test every key in source before you can push.
Albert Cardona II
@daddycardona
Aug 24 2017 17:24
I meant filter.every lol
Kyle Holm
@thekholm80
Aug 24 2017 17:24
filter and every are both good for this one
Albert Cardona II
@daddycardona
Aug 24 2017 17:25
so something like if(collection[i].every(Object.keys(source))
back to the drawing board lol
Stephen James
@sjames1958gm
Aug 24 2017 17:26
@daddycardona No if (Object.keys(source).every(function(srcKey) {// function that tests collection[i] }))
Jim Homme
@jhomme
Aug 24 2017 17:26
Hi, I'm on the chalenge to target multiple selectors with JQuery. I'm probably staring at this too long, and my screen reader does not tell me what part of my code is wrong. Can someone please give me a hint without telling me how to fix this? Here is my <script> tag.
Stephen James
@sjames1958gm
Aug 24 2017 17:26
@daddycardona It is Array.prototype.filter and Array.prototype.every
Jim Homme
@jhomme
Aug 24 2017 17:27
<script>
$(document).ready(function() {
$("button").addClass("animated");
$(".btn").addClass("shape");
$("#target1").addClasss("btn-primary");
});
</script>
Kyle Holm
@thekholm80
Aug 24 2017 17:27
@jhomme $(".btn").addClass("shape"); that's not how you spell shake
Jim Homme
@jhomme
Aug 24 2017 17:28
Oh man. :) Thanks. When I was listening to it and not examining every character, I thought it said "shape."
Albert Cardona II
@daddycardona
Aug 24 2017 17:28
@jhomme don't worry been there done that many times ;)
@sjames1958gm thanks I am going to study a little more on that I don't know why this other many told me every and I kept looking up each dammit me
CamperBot
@camperbot
Aug 24 2017 17:29
daddycardona sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8381 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Albert Cardona II
@daddycardona
Aug 24 2017 17:29
@thekholm80 not you someone else on here told me every() too and I kept looking up each lol
Stephen James
@sjames1958gm
Aug 24 2017 17:29
Sounds like break-time :)
Kyle Holm
@thekholm80
Aug 24 2017 17:30
@daddycardona i'm sure we've all been there
Albert Cardona II
@daddycardona
Aug 24 2017 17:30
but @thekholm80 thanks you always helping me and don't give me straight answers that helps too ;)
CamperBot
@camperbot
Aug 24 2017 17:30
daddycardona sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1452 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Albert Cardona II
@daddycardona
Aug 24 2017 17:30
I don't like when someone finishes my code but helps me understand something :)
Kyle Holm
@thekholm80
Aug 24 2017 17:30
give a man a fish ... yadda yadda
Albert Cardona II
@daddycardona
Aug 24 2017 17:31
lol
i don't know yadda but i know yoda lol
Jim Homme
@jhomme
Aug 24 2017 17:31
@thekholm80 That is so funny. :) Wow. Thanks again.
CamperBot
@camperbot
Aug 24 2017 17:31
jhomme sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1453 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Kyle Holm
@thekholm80
Aug 24 2017 17:33
@daddycardona my kryptonite is regexp. i don't think i've ever written a regexp without spending at least 5 minutes reading the MDN page for it first
Albert Cardona II
@daddycardona
Aug 24 2017 17:34
sometimes the MDN page messes me up more lol @thekholm80 so I read that and then go to a video to help explain it for me I liked to be shown by example and their examples are like wth lol
Kyle Holm
@thekholm80
Aug 24 2017 17:34
lol yeah
oh and for ..in and for ..of i don't think i've ever used either of those without looking up both of them
Albert Cardona II
@daddycardona
Aug 24 2017 17:37
I used for in many times because it basically says for(var i =0;i<something.length;i++) so to me for(var i in somethign)
That is how I look at it I never used for of though, at least not yet lol
Kyle Holm
@thekholm80
Aug 24 2017 17:38
never look it up and you'll never have to wonder which you're supposed to use lol
Albert Cardona II
@daddycardona
Aug 24 2017 17:39
LMAO
now that makes me want to look it up lol
Albert Cardona II
@daddycardona
Aug 24 2017 17:45
wow I just learned that if you used something like for(var k in anOject){ } k will be the keyword in that object holy macroni this could have saved me some time maybe lol
I will come back later :)
Kyle Holm
@thekholm80
Aug 24 2017 17:45
wait until you see what's coming in the next JS update
this is something i'm really excited to try
just1witness
@just1witness
Aug 24 2017 18:05
Soooooooo close!!!!! The right answer, wrong format, arrrrrrg! (exact change)
Klaus Mana
@KlausMana
Aug 24 2017 18:06
hi
just1witness
@just1witness
Aug 24 2017 18:08
hi
just1witness
@just1witness
Aug 24 2017 18:19
How do I convert
["ONE HUNDRED, 100","TWENTY, 20","TWENTY, 20","TWENTY, 20","QUARTER, 0.25","QUARTER, 0.25"]
to
["ONE HUNDRED", 100], ["TWENTY", 60.00],["QUARTER", 0.50]]?
teevik
@teevik
Aug 24 2017 18:29
You could loop through every 2 items of the array, and build a new array. And also check if the new array allready has that item, if so add to the number
just1witness
@just1witness
Aug 24 2017 18:37
I will have to try that @teevik thanks
CamperBot
@camperbot
Aug 24 2017 18:37
just1witness sends brownie points to @teevik :sparkles: :thumbsup: :sparkles:
:cookie: 234 | @teevik |http://www.freecodecamp.com/teevik
Kingsley
@Kingwindie
Aug 24 2017 18:40
can someone help me out,i'm tryring to make a linear gradient background for the body of an html but it does not work,but when i do a regular background it works fine
background-color: linear-gradient(42deg, #651FFF 0%, #6200EA 100%);
that does not work but
body {
     margin: 0;
     padding: 0;
     background: purple;
}
works fine
just1witness
@just1witness
Aug 24 2017 18:43
do you have to add the finishing color?
Jan Shah
@JanShah
Aug 24 2017 18:43
try
background: linear-gradient(42deg, #651FFF 0%, #6200EA 100%);
just1witness
@just1witness
Aug 24 2017 18:43
example linear-gradient(0deg, blue, green 40%, red);
Klaus Mana
@KlausMana
Aug 24 2017 18:46
i need some help
Kingsley
@Kingwindie
Aug 24 2017 18:46
@JanShah @just1witness tried both,did not work
Klaus Mana
@KlausMana
Aug 24 2017 18:46

function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line

  //Getting the keys for each object of collection
  for(var i = 0; i < collection.length; i++){
    var keys = Object.keys(collection[i]);

    //Testing each key separately
    for(var j = 0; j < keys.length; j++){
      var key = keys[j];

      if(collection[i][key] == source[key]){
        arr.push(collection[i]);
      }


    }
  }

  // Only change code above this line
  console.log(arr);
  return arr;
}

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
Kingsley
@Kingwindie
Aug 24 2017 18:46
this is so weird😁
Klaus Mana
@KlausMana
Aug 24 2017 18:46
wherefore art thou challenge
My code currently checks only if one of the values is correct, so in the last two examples since a is the same it returns every single one
I know that I have to find a way to make it so that it checks if all are true and then push, i just am not being able to figure out why
just1witness
@just1witness
Aug 24 2017 18:48
:( @Kingwindie sorry
Klaus Mana
@KlausMana
Aug 24 2017 18:48
I tried using a counter, but no help
Kingsley
@Kingwindie
Aug 24 2017 18:49
@just1witness thanks,it's probably has to do with my other css rules,it works perfectly fine on codepen too
CamperBot
@camperbot
Aug 24 2017 18:49
kingwindie sends brownie points to @just1witness :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @just1witness |http://www.freecodecamp.com/just1witness
just1witness
@just1witness
Aug 24 2017 18:50
@KlausMana Try using a filter()
and a for(i in source) loop
Klaus Mana
@KlausMana
Aug 24 2017 19:05
@just1witness that's exactly what i did and it worked
thx for caring :P
just1witness
@just1witness
Aug 24 2017 19:06
@KlausMana my pleasure :)
Ross Scarborough
@SourceHorse
Aug 24 2017 19:45
anyone good with vanilla JS api calls?
is there anything wrong with the way i'm calling this?
Jan Shah
@JanShah
Aug 24 2017 20:00
@SourceHorse looks ok
Ross Scarborough
@SourceHorse
Aug 24 2017 20:00
just feel awkward setting async to false
but it's the only way my current code works
Jan Shah
@JanShah
Aug 24 2017 20:01
it looks good, but there are many other ways to skin this particular cat :)
Ross Scarborough
@SourceHorse
Aug 24 2017 20:02
yeah, just want to be reasonably efficient
this is just what i could come up with
Jan Shah
@JanShah
Aug 24 2017 20:05
@SourceHorse
  fetch(urlFront + streamers[i] + urlEnd)  //returns a promise
    .then(response=>response.json()) //converts the returned body of the promise to json object
    .then(result=>console.log(result)) //do whatever you need with result
Ross Scarborough
@SourceHorse
Aug 24 2017 20:07
what does that do?
Justin25
@Justin25
Aug 24 2017 20:10

I'm using EJS to create buttons from a set of data, and then have a fetch request that is sent to my node server every time the button is clicked using this:

  <% for(var i=0; i<cards.length; i++) {%>
    <li class="card">
      <button id = "set"><span id = <%= cards[i] %>><%= cards[i] %></span></button>
    </li>
  <% } %>

My problem is that only the first button successfully sends the fetch request.
I am target the buttons via document.getElementById('set');

Jan Shah
@JanShah
Aug 24 2017 20:12
@SourceHorse it does all this
    var request = new XMLHttpRequest();
    request.open('GET', urlFront + streamers[i] + urlEnd, false);
    request.onload = function() {
      if (this.status >= 200 && this.status < 400) {
        var data = JSON.parse(this.response);
        ts.innerHTML = 'success';
        console.log(data);
Ross Scarborough
@SourceHorse
Aug 24 2017 20:14
is that from a js library?
Jan Shah
@JanShah
Aug 24 2017 20:15
@SourceHorse no, that's plain javascript
I've commented my code above so you get a better picture, you can also console log the output of response function to see the promise
Jan Shah
@JanShah
Aug 24 2017 20:31
@Justin25 do you have to use a key in the li or button?
Dylan
@dhcodes
Aug 24 2017 20:36
@Justin25 you'll probably want document.getElementsByClassName('yourclass') or document.getElementsByTagName('button') since IDs are unique to one element
Justin25
@Justin25
Aug 24 2017 21:39
@dhcodes Thanks a lot, worked perfectly.
CamperBot
@camperbot
Aug 24 2017 21:39
justin25 sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star2: 1829 | @dhcodes |http://www.freecodecamp.com/dhcodes
Gersho
@Gersho
Aug 24 2017 21:57
:wave: i slacked yesterday so let's get some work done today :3
Manish Giri
@Manish-Giri
Aug 24 2017 23:36
@thekholm80 ty
CamperBot
@camperbot
Aug 24 2017 23:36
manish-giri sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1454 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Kyle Holm
@thekholm80
Aug 24 2017 23:37
cookies!
Razvan
@razvanlikespizza
Aug 24 2017 23:40
TranslateX doesnt work, help pls.
image.png
i dont need yo help anymore bit*hes . I sovled it by ma self heh ya