These are chat archives for FreeCodeCamp/Help

21st
Jan 2018
Albert Cardona II
@daddycardona
Jan 21 2018 00:04
sorry was in the kitchen what up @thekholm80 just trying to work out the bugs in my javascript calc
like how to make math.eval(do percentages) lol
Kyle Holm
@thekholm80
Jan 21 2018 00:05
lol
isn't 'percent' from latin 'per centum'? like divide by 100?
oh wait, i'm dumb
Albert Cardona II
@daddycardona
Jan 21 2018 00:06
i dont know lol
Kyle Holm
@thekholm80
Jan 21 2018 00:07
The term "per cent" is derived from the Latin per centum, meaning "by the hundred"
not 'divide by 100' lol
Albert Cardona II
@daddycardona
Jan 21 2018 00:07
yeah but the percent sign is modulous sign in javascript is modulous
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:07
"1 per 100" = 1/100.
Kyle Holm
@thekholm80
Jan 21 2018 00:08
@daddycardona right, but you can write your code to do what you want
Albert Cardona II
@daddycardona
Jan 21 2018 00:08
yeah but using math eval is not making sense like I want to do math.eval(5+6%)
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:09
Because % doesn't mean what you think it means in Javascript.
Kyle Holm
@thekholm80
Jan 21 2018 00:09
pretty sure he knows what it means :point_up: January 20, 2018 5:07 PM
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:10
..then he'd know that 5+6% is a totally meaningless statement in eval. :-P
Albert Cardona II
@daddycardona
Jan 21 2018 00:10
I wish javascript had a word like 5+6per would work lol
yes @HeinousTugboat I do brother
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:10
If you want to do a percentage operator you're gonna have to use a different method.
Math.eval's gonna hold you to only what JavaScript understands, so any more complex operators won't work.
Kyle Holm
@thekholm80
Jan 21 2018 00:11
@daddycardona you can use the % sign on your calculator, you'll just have to stick your own logic to it
Albert Cardona II
@daddycardona
Jan 21 2018 00:11
yeah I see that now
I might have to do something like when I hit the percent sign it just does the math for me lol
I mean write a function that could do that math for me lol
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:12
Just have it wrap the whole statement in () and append /100.
Kyle Holm
@thekholm80
Jan 21 2018 00:12
right, something like ((valueA / valueB) * 100)
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:13
..I don't even know what a % symbol actually does on Windows calc..
Albert Cardona II
@daddycardona
Jan 21 2018 00:13
I was thinking about that append or
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:13
:laughing: What the heck.
Albert Cardona II
@daddycardona
Jan 21 2018 00:13
when you click the button it just does the math does not show the percent sign lol
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:14
10*3% = 0.3.
Yeah, I guess that makes sense.
Such a weird thing.
Albert Cardona II
@daddycardona
Jan 21 2018 00:14
LOL I just want that button to work LOL
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:14
I think using a regex to replace it tit-for-tat with /100 would get the same result.
Albert Cardona II
@daddycardona
Jan 21 2018 00:15
I am still trying to do that regex for shit like 3.. or 3.3.4
I got the repeated dots but how would I say if repeated dots lol
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:16
str.replace(/(\%)/g,'/100')
Albert Cardona II
@daddycardona
Jan 21 2018 00:16
my calculator is bad ass :)
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:16
I remember trying to help with that regex. Where'd that wind up at?
Albert Cardona II
@daddycardona
Jan 21 2018 00:17
its in a comment on the buttom of the script right now
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:17
:laughing: Fair.
Albert Cardona II
@daddycardona
Jan 21 2018 00:17
the casio calculator not the javascript calculator lol
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:17
So, the problem with using a regex for 3.3.4 is which . do you want to remove?
It's arguably better to throw an error since 33.4 and 3.34 are drastically different numbers.
Albert Cardona II
@daddycardona
Jan 21 2018 00:19
I am trying to figure out if I can write an if statement that asks that like string.regex(... ) or can I just write if(string.regex(/\.{2,}/g)
Gersho
@Gersho
Jan 21 2018 00:19
3.34 would be what happens when using a standard calculator (and syntax error for a scientific one)à
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:19
@daddycardona What do you mean?
Albert Cardona II
@daddycardona
Jan 21 2018 00:20
yeah I would definetly take out the second dot I also added a back button vs to clear buttons lol
can I write if(regext.test(string) || is it string.test(regex)
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:21
Yes, but why?
Gersho
@Gersho
Jan 21 2018 00:21
add a check when you press . and simply deny the input if it's already present ?
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:21
If you're testing it, it's easier to just run the replacement.
Otherwise you're executing the regex twice.
Albert Cardona II
@daddycardona
Jan 21 2018 00:22
@gersho wouldn't that also stop something like 3.5+5.3 ?
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:22
I agree with @Gersho. That makes sense. Check if the last character entered is a period.
Gersho
@Gersho
Jan 21 2018 00:23
@daddycardona in the check, make it "if there is already a dot, or if there is + - / * after the first dot, allow a second one"
are you allowing 1 + 2 - 5 + 2 in a single operation ? because dots would be complicated to handle if that's the case
Albert Cardona II
@daddycardona
Jan 21 2018 00:24
oh so I see what you guys are saying like if i pressed . once it should run a check however unfortunately for me I don't get where to put that check because I am taking a whole screen and making the equals take the display and parsing then math.eval
Gersho
@Gersho
Jan 21 2018 00:25
oh wait, you could check for "there has been no . since the last + - / *
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:26
Here's a horrible way to do it:
let arr = str.split(/[^\d\.]/g);
if (!arr[arr.length-1].includes('.')) { str += '.'; }
Albert Cardona II
@daddycardona
Jan 21 2018 00:26
hmmm
if(str.slice(0,-1) === '.'){disable . button }
that would not work with my code though lol
Gersho
@Gersho
Jan 21 2018 00:32
just like you did if (cn === 'equ') {
you can do the same for .
 if (cn === '.') {
     if(//magic to check double dot)){
          return; //so you don't run rest of click function and input effect stops here
        }
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:34
if (!str.match(/[^\d\.]?\d*\.\d*$/)) { addDot(); }
// Example cases:
{
  str1 = "1.2+34";
  str2 = "1.2+3.4";
  str3 = "1.2+.34";
  str4 = "1.2+34.";
  str5 = "12+34";

  re = /[^\d\.]?\d*\.\d*$/;

  console.log(!str1.match(re)); // true
  console.log(!str2.match(re)); // false
  console.log(!str3.match(re)); // false
  console.log(!str4.match(re)); // false 
  console.log(!str5.match(re)); // true
}
Albert Cardona II
@daddycardona
Jan 21 2018 00:35
so for repetive dots seem easy :)
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:35
Oh, didn't check how it handles more than one dot..
Yep. Works fine. :-D
Albert Cardona II
@daddycardona
Jan 21 2018 00:36
but you gave me this //str.replace(/.{2,}/g, '.')
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:36
So, these are two different things.
Albert Cardona II
@daddycardona
Jan 21 2018 00:36
so that would handle .. ?
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:37
str.replace(/.{2,}/g,'.') literally just says "go find any chain of dots in the string, and collapse them down to one dot".
That's it.
So ... becomes ., 1..2.3...5 becomes 1.2.3.5.
The fancier one says find a set of numbers with a dot in the middle that are at the end of the string and come after a non dot or digit.
That's why you have to negate it.
Does that make sense?
One is actively checking, one is just blindly pac-maning dots.
Kyle Holm
@thekholm80
Jan 21 2018 00:39
@daddycardona this worked (added line 20-25)
Albert Cardona II
@daddycardona
Jan 21 2018 00:40
so I should do this
    if (cn === "equ") {
            if (!dis.innerText) {
                dis.innerText = 0;
            }
            if (dis.innerText) {
                parser = math.parse(dis.innerText);
                dis.innerText = reg1.exec(dis.innerText);
                                 dis.innerText = reg2.exec(dis.innerText);// reg 1 n 2 for the reg expressions you gave me lol 
                dis.innerText = math.eval(dis.innerText);
            }
        }
oops let me edit that
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:40
@thekholm80 That doesn't seem to handle 1.2+3.4.
Kyle Holm
@thekholm80
Jan 21 2018 00:41
oh right, he's got everything in one string
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:41
Yeah, hence the crazy ridiculous RegEx.
:-D
Kyle Holm
@thekholm80
Jan 21 2018 00:41
i stored everything in arrays to make it all easier
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:42
/[^\d\.]?\d*\.\d*$/ = Find 0 or 1 non-digit non-decimal followed by 0 or more digits followed by a decimal followed by 0 or more digits follow by the end of the line.
I tokenized everything, used data-attributes on my elements and coverted the whole thing to RPN.
Albert Cardona II
@daddycardona
Jan 21 2018 00:44
man you is good but yeah like I put up there in my updated post
Gersho
@Gersho
Jan 21 2018 00:44
as pseudo code it would be no .since the last + - / * , maybe indexOf the 4 operands, pick the last one and finaly check for a dot ?
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:46
@Gersho I personally think the regex is way simpler than doing all that. :-|
Gersho
@Gersho
Jan 21 2018 00:46
probably but i don't know much regex-fu
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:47
I just explained what that regex does.. and more or less that. :-P
Albert Cardona II
@daddycardona
Jan 21 2018 00:47
so would I use str.replace or str.exec?
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:47
It finds the last non-. non-digit and checks for a dot after it.
!str.match(re)
str.exec isn't a function, re.exec.. does.. weird things.. and str.replace is only good if you're actually replacing things. This one isn't replacing, it's searching.
Albert Cardona II
@daddycardona
Jan 21 2018 00:49
I was like str.replace(regex) or reg.exec(str)?
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:49
I was like.. neither. str.match(regex). :-P
Or regex.test(str), I think.
Yeah, !regex.test(str) and !str.match(regex) should both give you the right answers.
Albert Cardona II
@daddycardona
Jan 21 2018 00:50
I am saying I would rather just replace the dam str just in case I have that issue with .. or 4.4.3 rather then worry about checking because it will do it for me lol
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:50
Oh.
None of what I've shared will help you deal with 4.4.3 after the fact.
Albert Cardona II
@daddycardona
Jan 21 2018 00:51
it is a lot easier to just be like i did up there
oh lol
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:51
Erm. Give me a sec, I'll see if I can find something.
I'm not too hot with lookarounds yet.
Albert Cardona II
@daddycardona
Jan 21 2018 00:52
i thought this did that re = /[^\d\.]?\d*\.\d*$/; @HeinousTugboat
but i see I was wrong
Alexander Jarman
@HeinousTugboat
Jan 21 2018 00:54
Ah, yeah, sorry for the confusion. That's meant to let you check whether you should accept a new decimal or not.
Albert Cardona II
@daddycardona
Jan 21 2018 00:58
oh yeah i figured that ou just now lol
why did you put the ^in the regex
Alexander Jarman
@HeinousTugboat
Jan 21 2018 01:00
A ^ inside of a [] negates it, so matches anything that doesn't match it.
So [^\d\.] is looking for something that is neither a digit nor a period.
I.E. a symbol, a letter, an operator, whatever.
Albert Cardona II
@daddycardona
Jan 21 2018 01:01
\/\d+\.\d+\.\d+/, \d+.\d this means I just rounded your shit up lol
obviously string.replace(thatstuff)
Alexander Jarman
@HeinousTugboat
Jan 21 2018 01:02
?
Albert Cardona II
@daddycardona
Jan 21 2018 01:03
so if I put str.replace(\/\d+\.\d+\.\d+/, \d+.\d) it deltes whats after the second . and rounded it up lol
i meand deletes the second . and everything after lol
well I will come back on tomorrow and try some of these regex things you talking about ;)
I need to get my shit together been busy and now time for UFC :)
Alexander Jarman
@HeinousTugboat
Jan 21 2018 01:05
@daddycardona That's.. not a valid regex..
Gersho
@Gersho
Jan 21 2018 05:04
finally finished the credit problem on cs50, coding in C be like "do i have to do everything myself ?" oh you want the length ? well better code it yourself son
Kyle Holm
@thekholm80
Jan 21 2018 05:33
@Gersho lol
Alexander Jarman
@HeinousTugboat
Jan 21 2018 05:59
I've now found two things in JavaScript that should exist, do exist in the spec, but everyone's like "Nah, we don't wanna do that."
PTC/TCO and Array.prototype.values.
At least, Chrome, Firefox and Node all explicitly don't implement Array.values. :-|
Kelechi Chinaka
@ke1echi
Jan 21 2018 06:01
:smile: i think that the fun part in C @Gersho
Eric Miller
@ericmiller777
Jan 21 2018 08:29
Hey guys
slri
@slri
Jan 21 2018 08:51
um guys there's more people in python chat than here, what is this
@ericmiller777 what's the issue?
Eric Miller
@ericmiller777
Jan 21 2018 08:57
I seem to have it working itsjust not passing
@RuinIsProbablyTaken but maybe i did it wrong?
slri
@slri
Jan 21 2018 08:58
@ericmiller777 show the code
Eric Miller
@ericmiller777
Jan 21 2018 09:00
@siri how do i link code on here i forget?
something at the start and end of the code
slri
@slri
Jan 21 2018 09:01
backticks ```js
and at the end just backticks
Eric Miller
@ericmiller777
Jan 21 2018 09:01
const inputStyle = {
  width: 235,
  margin: 5
}

class CheckUserAge extends React.Component {
  constructor(props) {
    super(props);
    // change code below this line
    this.state = {
      input: "",
      userAge: ""
    };
    // change code above this line
    this.submit = this.submit.bind(this);
    this.handleChange = this.handleChange.bind(this);
  }
  handleChange(e) {
    this.setState({
      input: e.target.value,
      userAge: ''
    });
  }
  submit() {
    this.setState({
      userAge: this.state.input
    });
  }
  render() {
    const buttonOne = <button onClick={this.submit}>Submit</button>;
    const buttonTwo = <button>You May Enter</button>;
    const buttonThree = <button>You Shall Not Pass</button>;
    return (
      <div>
        <h3>Enter Your Age to Continue</h3>
        <input
          style={inputStyle}
          type="number"
          value={this.state.input}
          onChange={this.handleChange} /><br />
        {buttonOne}
        {this.state.userAge >= 18 ? buttonTwo : buttonThree}
      </div>
    );
  }
};
I see my issue is that it always renders a button even before the button is clicked?
maybe
without messing with the other code tho
how can i check when [buttonOne} is clicked?
@RuinIsProbablyTaken if i mess with the const i could probably do it, but ive been trying not to unless im certain theres a bug
slri
@slri
Jan 21 2018 09:06
onClick={/* handle the event here*/}
should be added to the button
Eric Miller
@ericmiller777
Jan 21 2018 09:07
hmm
1 sec
slri
@slri
Jan 21 2018 09:07
i think you should add that ternary to the onClick event of the button?
const buttonOne = <button onClick={this.submit}>Submit</button>;
it already has it
Eric Miller
@ericmiller777
Jan 21 2018 09:08
?
slri
@slri
Jan 21 2018 09:09

how can i check when [buttonOne} is clicked?

i was answering this question

Eric Miller
@ericmiller777
Jan 21 2018 09:09
i ddnt make that part, I think im only supposed to change aything below onChange at the bootom
bottom
slri
@slri
Jan 21 2018 09:09
yes, i know
what i'm saying is that it's handled for you
Eric Miller
@ericmiller777
Jan 21 2018 09:09
{buttonOne onClick = {this.state.userAge >= 18 ? buttonTwo : buttonThree}}
slri
@slri
Jan 21 2018 09:10
nah
that makes no sense
Eric Miller
@ericmiller777
Jan 21 2018 09:10
how should i pss in the ternary?
slri
@slri
Jan 21 2018 09:10
because button one is literally a closed element so you'd be adding that on click event handler to nothing
Eric Miller
@ericmiller777
Jan 21 2018 09:11
how can i pass it in from [button]
@RuinIsProbablyTaken been at this one for a bit
slri
@slri
Jan 21 2018 09:13
@ericmiller777 you need double ternary i think
Eric Miller
@ericmiller777
Jan 21 2018 09:13
@RuinIsProbablyTaken okay first one
checks if page has been rendered?
slri
@slri
Jan 21 2018 09:14
check if the age is even set, if not button one, if so check if it's above or below 18
Eric Miller
@ericmiller777
Jan 21 2018 09:14
okay
slri
@slri
Jan 21 2018 09:14
i don't really know react so i'm just talking out of my ass
image.png
it works /shrug
Eric Miller
@ericmiller777
Jan 21 2018 09:20
@RuinIsProbablyTaken thanks, trying to get it to work
CamperBot
@camperbot
Jan 21 2018 09:20
ericmiller777 sends brownie points to @ruinisprobablytaken :sparkles: :thumbsup: :sparkles:
:cookie: 756 | @ruinisprobablytaken |http://www.freecodecamp.org/ruinisprobablytaken
slri
@slri
Jan 21 2018 09:22
you don't have to change the ternary you came up with, just go "are you empty? display button one, if you aren't the ternary you came up at first"
i'm so bad at english this morning :C
Eric Miller
@ericmiller777
Jan 21 2018 09:24
@RuinIsProbablyTaken got it :) thank you
CamperBot
@camperbot
Jan 21 2018 09:24
ericmiller777 sends brownie points to @ruinisprobablytaken :sparkles: :thumbsup: :sparkles:
api offline
slri
@slri
Jan 21 2018 09:25
npnp~
Dimitris Nik.
@dimitrissnk
Jan 21 2018 09:58
Can anybody help me with the first fcc project in html/css?
Eric Miller
@ericmiller777
Jan 21 2018 10:01
@Dimitrios51 the tribute page?
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:01
@ericmiller777 Yeap
Eric Miller
@ericmiller777
Jan 21 2018 10:02
what do you need?
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:03
@ericmiller777 Here is my page: https://codepen.io/dimitris51/full/zpeKBq/
I want to place the last paragraph in the white space, underneath the background image, but whatever I try, the background image gets disturbed
slri
@slri
Jan 21 2018 10:03
@ericmiller777 turn off your js before you open it uwu
just to be safe panic
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:04
I am not using JS
Eric Miller
@ericmiller777
Jan 21 2018 10:04
@siri its safe
Eric Miller
@ericmiller777
Jan 21 2018 10:13
@Dimitrios51 change your .home class to this
body {
  background-image:url('https://i.imgur.com/x2UFTdt.jpg');
  background-repeat:no-repeat;
  background-size:cover;
}
if thats your first site, its very good
tell me if you meant somthing different
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:17
@ericmiller777 Thanks for the code and for your good words! But even with that code how am I going to move the last paragraph? :/
CamperBot
@camperbot
Jan 21 2018 10:17
dimitrios51 sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:cookie: 323 | @ericmiller777 |http://www.freecodecamp.org/ericmiller777
Eric Miller
@ericmiller777
Jan 21 2018 10:18
What do you mean by move?
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:19
@ericmiller777 see here: http://prntscr.com/i3f782
Position the "My name is Dimitris..." in the white space...
slri
@slri
Jan 21 2018 10:20
@Dimitrios51 instead of having that bg on the body, wrap the above paragraphs in a wrapper div and put it there
then put the last paragraph outside of that wrapper
Eric Miller
@ericmiller777
Jan 21 2018 10:20
yea but then he will have whitespace all the way around
slri
@slri
Jan 21 2018 10:21
@ericmiller777 no? margin 0, padding 0 on the wrapper, no whitespace where it shouldn't be
Eric Miller
@ericmiller777
Jan 21 2018 10:22
gtg gl :)
slri
@slri
Jan 21 2018 10:22
hf
@Dimitrios51 the holy land of greece and serbia? which one of those lmfao
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:23
@RuinIsProbablyTaken forgot an "s" :P
slri
@slri
Jan 21 2018 10:24
@Dimitrios51 nah i mean which one of those do you live in cuz greece and serbia speak 2 totally different languages lmao
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:24
@RuinIsProbablyTaken I leave in Greece but I am half Serb :P
slri
@slri
Jan 21 2018 10:25
@Dimitrios51 do you speak serbian then?
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:25
@RuinIsProbablyTaken could you send me an example code? I am trying to figure out how to do that with the divs
@RuinIsProbablyTaken kinda
@RuinIsProbablyTaken Don't tell me that you are Serbian too
slri
@slri
Jan 21 2018 10:27
<div class="wrapper">
<!-- here's the stuff that you want to be on the background -->
</div>
<p>I'm blah blah and blah blah, email me.</p>
that's for html, and css:
.wrapper {
  background-image:url('https://i.imgur.com/x2UFTdt.jpg');
  background-repeat:no-repeat;
  background-size:cover;
}
@Dimitrios51 jeste, srpski mi je maternji
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:30
@RuinIsProbablyTaken sestro :D
Do you live there?
slri
@slri
Jan 21 2018 10:30
nah, i live in spain. serbia is a shithole
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:32
@RuinIsProbablyTaken why are u saying that? Its a really good place, good ppl
slri
@slri
Jan 21 2018 10:33
nah, i've lived there since i was born, i grew up there. it's great as long as you don't live there
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:34
@RuinIsProbablyTaken I will move to Serbian in a year for studies :'(
slri
@slri
Jan 21 2018 10:34
people are also assholes, i've never met kinder people than people in spain honestly
Dimitris Nik.
@dimitrissnk
Jan 21 2018 10:37
@RuinIsProbablyTaken assholes are everywhere :P
slri
@slri
Jan 21 2018 10:38
that's also true
Ahmad Abdolsaheb
@ahmadabdolsaheb
Jan 21 2018 13:32

hey everyone, I am mapping through an array to produce a list of span elements in react and I need to use some data from the array to add to the class of each element. so far i have been unsuccessful .

{this.state.cards.map((card, index) => <span className="badge badge-secondary ${card.type}"/>)}

however in the inspector, i get .${card.type} as a class instead of the value of card.type.

Sorin Ruse
@sorinr
Jan 21 2018 13:41
@ahmadabdolsaheb its because you are defining all classes as a string: className="badge badge-secondary ${card.type}". you need to concatenate your var ${card.type} to the other classes
Ahmad Abdolsaheb
@ahmadabdolsaheb
Jan 21 2018 13:46
thank you @sorinr className={"badge badge-secondary " + card.type} worked
CamperBot
@camperbot
Jan 21 2018 13:46
ahmadabdolsaheb sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1393 | @sorinr |http://www.freecodecamp.org/sorinr
Sorin Ruse
@sorinr
Jan 21 2018 13:46
@ahmadabdolsaheb :+1:
Naris R
@KittenHero
Jan 21 2018 13:58
This message was deleted
Momozor
@momozor
Jan 21 2018 14:23
Hello world
Fabien SHAN
@X140hu4
Jan 21 2018 14:47
dlrow olleH
Ken Haduch
@khaduch
Jan 21 2018 16:34
@faraco - hello. Are you new at freeCodeCamp? If so, welcome!
Karthikeyan
@skarthikeyan96
Jan 21 2018 17:45
hello guys
0
what is wrong with this?
artbohr
@artbohr
Jan 21 2018 18:08
@skarthikeyan96
const LOCAL_FORECAST = {
  today: { min: 72, max: 83 },
  tomorrow: { min: 73.3, max: 84.6 }
};

function getMaxOfTmrw(forecast) {
  "use strict";
  // change code below this line
  const { tomorrow :{ max: maxOfTomorrow}} = forecast;
  // change code above this line
  return maxOfTomorrow;
}

console.log(getMaxOfTmrw(LOCAL_FORECAST)); // should be 84.6
Karthikeyan
@skarthikeyan96
Jan 21 2018 18:13
thank you very much @artbohr
CamperBot
@camperbot
Jan 21 2018 18:13
skarthikeyan96 sends brownie points to @artbohr :sparkles: :thumbsup: :sparkles:
:cookie: 339 | @artbohr |http://www.freecodecamp.org/artbohr
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:24
hey guys i have an issue, everytime i log out of FCC i seem to lose all input on my FCC waypoints and challenges. i asked here yesterday and it was mentioned it could be because i changed computers. this time i didn't but the only thing i can think of is deleting browsing data from google chrome as its a shared computer. is this causing it? and if so what do i not delete to keep my answers?
Aditya
@ezioda004
Jan 21 2018 19:28
@HappyMeerkat Are you logged in the same local user? Not in some other local user account?
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:29
on the laptop? yes
@ezioda004 its the same account on the laptop (the only account) and the same for FCC. i finished on FCC this morning and logged out, deleted browsing data from Chrome, laptop went to sleep as i closed the lid, opened lid and logged back in through Github
@ezioda004 even when i look on my profile on FCC and click view solution its gone
Aditya
@ezioda004
Jan 21 2018 19:35
The solution is gone?
It shouldnt delete from the server
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:36
yes, i looked at one it said i did this morning and its not there
Aditya
@ezioda004
Jan 21 2018 19:36
Did you pass the challenge?
It only saves if you complete it
Darren
@DarrenfJ
Jan 21 2018 19:38
morning fCC.. another day of lounging... back to it Monday... codeON!
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:40
yes, i used the FCC forum and somebody replied its a known bug that sometimes if you log in with a different method as you did originally, it sometimes makes a duplicate. so im gonna try logging out and logging in another way, although i thought it was the original way
Darren
@DarrenfJ
Jan 21 2018 19:40
@HappyMeerkat you're on your profile page and clicking completed solutions and not getting your code back?
ah yes.. you need to log in via your initial way you created the account
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:41
i've been signing in through Github, i'm gonna try doing it through normal email
Aditya
@ezioda004
Jan 21 2018 19:42
Well if you completed the challenge via your Github account then it should be there.
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:42
when i sign in through email, it puts me on the beta site
Aditya
@ezioda004
Jan 21 2018 19:42
@DarrenfJ :wave:
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:42
github puts me on 245 waypoints on the normal site but lost data
Aditya
@ezioda004
Jan 21 2018 19:43
Log out the www.freecodecamp.org and login via email
Darren
@DarrenfJ
Jan 21 2018 19:43
@ezioda004 hey buddy!
@HappyMeerkat this profile it looks like you spent the last few days redoing solutions you logged back in 2016 originally.. https://www.freecodecamp.org/HappyMeerkat
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:44
@DarrenfJ yes, but when i click on the solutions they are empty
Darren
@DarrenfJ
Jan 21 2018 19:45
when yer logged in, click on the number beside you pic. that will go to your profile.. i am curious what the url for each of our ways to log in is...
Aditya
@ezioda004
Jan 21 2018 19:45
I can see the solution, thats in your profile
Actually..its showing me my own solution.
slri
@slri
Jan 21 2018 19:47
lmfao good job @ezioda004
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:47
Darren
@DarrenfJ
Jan 21 2018 19:47
@Manish-Giri thanks for the codewars.. will check it out tonight..
CamperBot
@camperbot
Jan 21 2018 19:47
darrenfj sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:47
CamperBot
@camperbot
Jan 21 2018 19:47
:star2: 6806 | @manish-giri |http://www.freecodecamp.org/manish-giri
Darren
@DarrenfJ
Jan 21 2018 19:47
off to go be lazy ;)
DarrenfJ @DarrenfJ sneaks off
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:48
its also got my streak as one day when it should be 2-3 days
on my github one
it says i don't have an email ID associated with my Github account one so what other way could i have signed up?
Aditya
@ezioda004
Jan 21 2018 19:50
Ah its because of this
So if you dont have a local copy, then you can't view your own solution
It is saved in database but viewing for now is disabled.
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:52
so in the future i will be able to view my answers as they are in the database? but if i delete my browsing history i'll lose it all for now as its getting rid of my local copy
when they reactivate it
i mean
Aditya
@ezioda004
Jan 21 2018 19:54
Yes, it should work unless they wipe the database, since you're not keeping local copy in browser maybe you should push the solution to your github? Or save somewhere in your hdd?
HappyMeerkat
@HappyMeerkat
Jan 21 2018 19:56
yeah good idea, its just annoying as i typed notes to read later on to try the excercise again, now i need that all again haha.
@ezioda004 thanks! time to help my mum sort out her legs then back to coding!
CamperBot
@camperbot
Jan 21 2018 19:56
happymeerkat sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 406 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Aditya
@ezioda004
Jan 21 2018 19:58
@HappyMeerkat Happy to help :thumbsup:
slri
@slri
Jan 21 2018 20:30
hi friends i need some ideas for a simple api that's not something already given in the fcc curriculum
VaseJS
@VaseJS
Jan 21 2018 20:36
huh?
Aditya
@ezioda004
Jan 21 2018 20:36
@RuinIsProbablyTaken Google maps api?
VaseJS
@VaseJS
Jan 21 2018 20:36
not even sure what you’re asking so i can’t help :D
slri
@slri
Jan 21 2018 20:39
no
like a microservice
would be nice to come up with something that doesn't depend on anything else and isn't too demanding cuz i wanna make it in like 2 hours max
Aditya
@ezioda004
Jan 21 2018 20:49
What do you mean by doesnt depend on anything else? Maps api isnt too demanding and its pretty easy to use and they have proper docs
slri
@slri
Jan 21 2018 20:52
= w = right, but what do i make my service actually do then
Aditya
@ezioda004
Jan 21 2018 20:57
Hmm
Maybe direction from A to B?
Or maybe have user input and find infromation about the address?
slri
@slri
Jan 21 2018 20:58
all right, sounds promising. i'll check the docs out
:D
Henry
@GitHub-Henry
Jan 21 2018 21:53
In win 7, is it possible to command prompt to a shared drive? The drive appears in Explorer, but when I cd z:\ I get a drive not found msg. I can cd:c\ so I know I can get to a root directory.
slri
@slri
Jan 21 2018 21:56
@GitHub-Henry here's a weird idea: google it?
it's a very general-sounding problem, should get an easy answer
Henry
@GitHub-Henry
Jan 21 2018 21:56
@RuinIsProbablyTaken that was my next step. have you cmd to a shared drive
i've always cd to a local drive, didn't think there would be a difference
slri
@slri
Jan 21 2018 21:58
probably possible, just need a different way if it's not working the way you expect it to?
i mean, i don't see why would it not be possible to go to the shared drive directory through cmd when you can do it through explorer
Henry
@GitHub-Henry
Jan 21 2018 21:59
@RuinIsProbablyTaken i'm using a vm, but i don't think that should matter
slri
@slri
Jan 21 2018 21:59
it's shared with the vm, right?
Henry
@GitHub-Henry
Jan 21 2018 22:00
that's how i get explorer to see it
slri
@slri
Jan 21 2018 22:00
i've moved to a shared drive on fedora, should be similar on windows just a bit more complicated i guess cuz ms really likes to complicate things
Henry
@GitHub-Henry
Jan 21 2018 22:01
trying a solution from google
@RuinIsProbablyTaken you are right ms complicates things, need to use netuse command to make it work
but it works now
slri
@slri
Jan 21 2018 22:24
well, at least it works; hopefully it wasn't too much hassle
Daniel
@dkapexhiu
Jan 21 2018 23:20
why does not the pickUp work for Character on this board game?
Character.prototype.pickUp = function()
{
    if(this.tileTo[0]!=this.tileFrom[0] ||
        this.tileTo[1]!=this.tileFrom[1])
    {
        return false;
    }

    var is = mapTileData.map[toIndex(this.tileFrom[0],
                this.tileFrom[1])].itemStack;

    if(is!=null)
    {
        var remains = this.inventory.addItems(is.type, is.qty);

        if(remains) { is.qty = remains; }
        else
        {
            mapTileData.map[toIndex(this.tileFrom[0],
                this.tileFrom[1])].itemStack = null;
        }
    }

    return true;
};
Daniel
@dkapexhiu
Jan 21 2018 23:40
doesnt mind it works.. how can i start a battle when two players are near?
alpox
@alpox
Jan 21 2018 23:41
@dkapexhiu The battle is usually just the "walking into the other" meaning if the enemy is left and you press left, you hit him. If you press left again, you hit him again
And if the enemy is dead from the hitting, he disappears and you take his place
Daniel
@dkapexhiu
Jan 21 2018 23:46
for example. if i have this code, how can i tell the user with javascript that if hit the other player then battle starts? @alpox sorry, i am new to this
https://pastebin.com/VYmEP7xz
alpox
@alpox
Jan 21 2018 23:47
There is no such thing as "battle starts" or "battle ends" there is only "enemy has an amount of life" and if you run into it, it looses it every time you run into it
You know yourself best what is where in that code so i'm sure you will figure out. A hint: You fight during the moves of the player.
slri
@slri
Jan 21 2018 23:53
i don't think you need a battle beginning and end, but if you really need those you can always just start the battle when one of the players enters combat with the other player (as in hits the other player). this is only useful if there are some changes to the environment while in combat be it visual or mechanical