These are chat archives for FreeCodeCamp/HelpJavaScript

25th
Aug 2017
Fernando
@lestairon
Aug 25 2017 00:00
And ES6 doesn't have libraries like ES5, right?
Jason Luboff
@JLuboff
Aug 25 2017 00:01
I have to go...but ES6 is just a newer standard for Javascript
Conor Murphy
@cmurphy580
Aug 25 2017 00:24
@cmurphy580
Hey can anyone tell why this flex box isn't working for the bottom div content
https://codepen.io/cmurphy580/pen/wqxjeW
Marc
@MWBauer
Aug 25 2017 00:25
HI everyone
Pagnito
@Pagnito
Aug 25 2017 00:25
hey i havea bit of a dillemma, im doing recipe box challenge
Greg Duncan
@GregatGit
Aug 25 2017 00:27
@Pagnito what's up?
Pagnito
@Pagnito
Aug 25 2017 00:28
i have choice of simply appending each ingridient and its amoount onto a list (a list before submiting to local storage) this list sits in the modal to just have a preview of whats about to get submitted. even tho react is all about rerendering single elements and stuff, i dont know how to use react to simply append one item at a time, i was about to just use {this.state.ingridients} and map thru it on every state change thus rerendering with a new item every time, but i feel like that in itself with the mapping is more processing than just simply javascript append
Greg Duncan
@GregatGit
Aug 25 2017 00:29
@Pagnito I will be back in 15min
Pagnito
@Pagnito
Aug 25 2017 00:29
k
Greg Duncan
@GregatGit
Aug 25 2017 00:30
@Pagnito did you intall the react tools in chrome browser? You use them to see what is in state
Pagnito
@Pagnito
Aug 25 2017 00:31
nah i havent yet, im not really havin trouble getting it done
im just thinking which way is best for least processing
tho im def gonna find those react tools now that u mention it, link?
BrianWilliams28
@BrianWilliams28
Aug 25 2017 00:32
@anyone who's done the Smallest Common Multiple challenge, could someone give me a hint on what to do next? Here's what i have come up with so far...
function smallestCommons(arr) {
  var range = []; // [18, 19, 20, 21, 22, 23]
  var sort = arr.sort(function(a, b) { // smallestCommons(23,18) => smallestCommons(18,23);
    return a - b;
  });
 for (var i = sort[0]; i <= sort[1]; i++) {
  range.push(i);
 }

  return arr;
}


smallestCommons([23,18]);
Gersho
@Gersho
Aug 25 2017 00:38
why having the range variable ? since the sort one seem to be identical ?
wait nvm
ok so at this point you've made [18,19,20,21,22,23] array and wonder what to do next ?
Gersho
@Gersho
Aug 25 2017 00:44
the link they provide as hint doesn't provide any intersting mathematical proof, try
http://www.math.com/school/subject1/lessons/S1U3L3DP.html @BrianWilliams28
Conor Murphy
@cmurphy580
Aug 25 2017 00:46
@BrianWilliams28 you need to know the formula for lcm and greatest common denominator. the greatest common denominator function uses recursion.
Greg Duncan
@GregatGit
Aug 25 2017 00:48
@Pagnito you want to install React Developer Tools and React-detector in your chrome extensions
Greg Duncan
@GregatGit
Aug 25 2017 00:57
@Pagnito When you are dealing with state -any changes in State fires off a rerender - and you don't append to something in state - you setState - so you would copy the state - make changes to the copy - then setState with the new modified state - React will rerender and if there are any changes needed in the DOM - it will render those
Pagnito
@Pagnito
Aug 25 2017 01:07
@GregatGit yea i know, my question is should i use state to rerender which will require remapping thru new state array ingridients or simply just append a new ingridient with regular javascript
Greg Duncan
@GregatGit
Aug 25 2017 01:08
@Pagnito I would do it through state
Pagnito
@Pagnito
Aug 25 2017 01:08
k thanks @GregatGit
CamperBot
@camperbot
Aug 25 2017 01:08
pagnito sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 885 | @gregatgit |http://www.freecodecamp.com/gregatgit
Greg Duncan
@GregatGit
Aug 25 2017 01:09
@Pagnito that way any changes to state will trigger a rerendering
KatSaldivar
@KatSaldivar
Aug 25 2017 01:25
hmm, I set the value of a radio button to "6" and I'm trying to turn it into an int instead of a str. why does parseInt($('input:radio[name=size]:checked').val()); not work?
Pagnito
@Pagnito
Aug 25 2017 01:32
@GregatGit hey u know how to load svgs in react and webpack?
Jasmin
@jsmnvlcrt
Aug 25 2017 01:43
Hey everyone! Could someone explain the https://www.freecodecamp.org/challenges/introducing-else-if-statements? I got the else statment easily but this just won’t click with my brain. Much appreciated if you could explain the code. Thanks!
Gersho
@Gersho
Aug 25 2017 01:46
did you try saying it aloud ?
IF i have more than 5€ ELSE IF someone is paying for me, THEN i can eat, ELSE i'll starve
you use else if to chain conditional operators
Joseph
@Big-jo
Aug 25 2017 01:50
<div id="IntroPage">
            <span><h1>Travel</h1><h1>Buddy</h1></span>
        </div>
The second text is still breaking into a second line
Gersho
@Gersho
Aug 25 2017 01:51
too big maybe ? also try putting them in the same h1
Joseph
@Big-jo
Aug 25 2017 01:51
i cant i want to have a text with two different colors
travel in one color and buddy in another
@Gersho
Gersho
@Gersho
Aug 25 2017 01:53
unless you lack horizontal space it should be on the same line afaik
Joseph
@Big-jo
Aug 25 2017 01:55
nope, span is still not working for me
but is span supposed to work for <heading> elements
or tags
Ellyria
@Ellyria
Aug 25 2017 01:57
The h1 element is a block element. If you want that on one line, you can use CSS to style h1 as an inline element.
Joseph
@Big-jo
Aug 25 2017 01:58
@ellyria thanks, but can that be done with bootstrap?
Ellyria
@Ellyria
Aug 25 2017 01:58
Yes, you can use CSS and JavaScript with Bootstrap.
Joseph
@Big-jo
Aug 25 2017 01:58
how?
Ellyria
@Ellyria
Aug 25 2017 01:59
The same way you normally would. It's just that once in a while you'll have conflicting rules, and you'll need to examine the Bootstrap code to find out why or mess around with your code for a while to figure it out (whichever method you prefer).
Joseph
@Big-jo
Aug 25 2017 01:59
Dont worry i'll find a way
Ellyria
@Ellyria
Aug 25 2017 01:59
In this case I don't think you'd run into a conflict.
Ken Haduch
@khaduch
Aug 25 2017 02:00
@KatSaldivar - what does your HTML look like?
Gersho
@Gersho
Aug 25 2017 02:00
how about <span>word1</span><span>word2</span>
and give each their respective styling
Joseph
@Big-jo
Aug 25 2017 02:01
hmm, lemme try
Ellyria
@Ellyria
Aug 25 2017 02:01
That would work fine as well.
In case you want to do the block and inline thing, this page should help with that: https://www.w3schools.com/css/css_display_visibility.asp
Gersho
@Gersho
Aug 25 2017 02:02
w3 docs are really great
Ellyria
@Ellyria
Aug 25 2017 02:02
I love them.
Joseph
@Big-jo
Aug 25 2017 02:05
@Gersho nope, didnt work
Ellyria
@Ellyria
Aug 25 2017 02:06
@Big-jo did you use a different id for each span?
Joseph
@Big-jo
Aug 25 2017 02:06
honestly i didnt even use any id
Ellyria
@Ellyria
Aug 25 2017 02:06
If you use a different id for each span, you can assign a different color to each one.
Gersho
@Gersho
Aug 25 2017 02:07
do you have a pen ?
Joseph
@Big-jo
Aug 25 2017 02:07
no i'm using an editor
Ellyria
@Ellyria
Aug 25 2017 02:07
You can also surround both spans in an h1 element if you want it to be a heading.
Joseph
@Big-jo
Aug 25 2017 02:07
@Ellyria it's still isnt on the same line
Ellyria
@Ellyria
Aug 25 2017 02:07
Isn't that what you wanted, @Big-jo?
Joseph
@Big-jo
Aug 25 2017 02:08
<!doctype html>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link rel="stylesheet" href="StyleSheet.css">
    <link rel="stylesheet" href="resources/material.min.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" href="resources/Bootstrap/bootstrap-4.0.0-alpha.6-dist/css/bootstrap.min.css">
    <script src="resources/material.min.js"></script>
</head>
<body>
    <div class=".container-fluid">
        <div id="IntroPage">
            <span id="one"><h1>Travel</h1></span>
            <span id="two"><h1>Buddy</h1></span>
        </div>
    <div>
</body>
<script src="JavaScript.js" type="text/javascript" charset="utf-8" async defer></script>
</html>
oh oh
i see the problem
Gersho
@Gersho
Aug 25 2017 02:08
you left the h1
Ellyria
@Ellyria
Aug 25 2017 02:08
Ah, if you remove those h1 tags, it should work.
Joseph
@Big-jo
Aug 25 2017 02:08
the doctype declaration
nope it wasnt
@Ellyria lemme try
Gersho
@Gersho
Aug 25 2017 02:09
<div class=".container-fluid"> should there be a dot here ?
Ellyria
@Ellyria
Aug 25 2017 02:10

You could try something like this:

<h1><span id="one">Travel</span>
<span id="two">Buddy</span></h1>

Or this:

<h1><span id="one">Travel</span> <span id="two">Buddy</span></h1>
Joseph
@Big-jo
Aug 25 2017 02:10
nope there shouldnt
Ellyria
@Ellyria
Aug 25 2017 02:10
No, the dot is only used in CSS.
Gersho
@Gersho
Aug 25 2017 02:11
@Ellyria what's the difference between the 2 you proposed ?
they look the same to me
Ellyria
@Ellyria
Aug 25 2017 02:11
The first one is coded on two lines, but because of the way HTML behaves, if you put it on two lines, it will automatically insert a space between the two spans. The second one is coded on one line, and since it's not on two lines, you have to manually insert the space between the two spans.
Joseph
@Big-jo
Aug 25 2017 02:11
@Ellyria it worked
Ellyria
@Ellyria
Aug 25 2017 02:12
Yay!
Joseph
@Big-jo
Aug 25 2017 02:12
@Gersho @Ellyria thanks
CamperBot
@camperbot
Aug 25 2017 02:12
big-jo sends brownie points to @gersho and @ellyria :sparkles: :thumbsup: :sparkles:
:cookie: 502 | @ellyria |http://www.freecodecamp.com/ellyria
:cookie: 360 | @gersho |http://www.freecodecamp.com/gersho
Ellyria
@Ellyria
Aug 25 2017 02:12
The reason it worked is that h1 is a block element, which means that each h1 takes up an entire line. Span is an inline element, so you can have more than one of them in a line.
Gersho
@Gersho
Aug 25 2017 02:13
\o/
Ellyria
@Ellyria
Aug 25 2017 02:13
You could also have left it the way you originally had it and created a CSS rule that specifies that those h1 elements were inline rather than block.
Gersho
@Gersho
Aug 25 2017 02:14
@Ellyria didn't know about that inserted space if you put it on 2 lines, thanks !
CamperBot
@camperbot
Aug 25 2017 02:14
gersho sends brownie points to @ellyria :sparkles: :thumbsup: :sparkles:
:cookie: 503 | @ellyria |http://www.freecodecamp.com/ellyria
Joseph
@Big-jo
Aug 25 2017 02:14
how do you select multiple classes in css?
Gersho
@Gersho
Aug 25 2017 02:14
why would you want that ? if settings are common to multiple classes, move them to the same class
Ellyria
@Ellyria
Aug 25 2017 02:14
Any time. I didn't realize it either until recently. It's kind of useful to have in your toolbox, though, since you can write multiple lines of code knowing exactly what will happen when the browser displays it.
Joseph
@Big-jo
Aug 25 2017 02:15
@Gersho yh,just realised
Fernando
@lestairon
Aug 25 2017 02:15
Can i do an if inside an if conditional?
Ken Haduch
@khaduch
Aug 25 2017 02:15
@lestairon - You can, if you're thinking about what I'm thinking about.
Ellyria
@Ellyria
Aug 25 2017 02:15
@Big-jo, freeCodeCamp actually has some nice tutorials for this sort of thing. Have you gone through those?
Yes, definitely, @lestairon.
Gersho
@Gersho
Aug 25 2017 02:16
@lestairon sure, inside the then block {} you can put whatever you want
Fernando
@lestairon
Aug 25 2017 02:16
Oh, ty
Ellyria
@Ellyria
Aug 25 2017 02:16
You can nest them indefinitely, within the bounds of the resources of your computer.
Ken Haduch
@khaduch
Aug 25 2017 02:16
@lestairon - you can do
if ( test_condition_1) {
    if ( test_condition_2) {
         stuff here;
    }
}
Fernando
@lestairon
Aug 25 2017 02:16
Nono, i meant
Inside the ()
Ken Haduch
@khaduch
Aug 25 2017 02:17
@lestairon - no
Ellyria
@Ellyria
Aug 25 2017 02:17
No.
Claudio Restifo
@Marmiz
Aug 25 2017 02:17
@lestairon sure thing:
if ( ture ) {
  if ( > 3 ) {
    return 'bigger than 3';
  }

  return 'smaller than 3'
}
Gersho
@Gersho
Aug 25 2017 02:17
that would make no sense
Fernando
@lestairon
Aug 25 2017 02:17
Hm
Ellyria
@Ellyria
Aug 25 2017 02:17
Gosh, it would be fun trying to make that happen, though.
Ken Haduch
@khaduch
Aug 25 2017 02:18
@lestairon - but you can do:
if ( condition_1 && condition_2 && condition_3 ){
    // do something here
}
Fernando
@lestairon
Aug 25 2017 02:19
Thanks, haha
Gersho
@Gersho
Aug 25 2017 02:19
and use || for OR
Fernando
@lestairon
Aug 25 2017 02:19

Isn't the same with this?

return a> b? 5 : b > c ? 10 : 2;

So essentially if a is greater then b, return 5, if not, check b is greater than c, return 10 else return 2

Ken Haduch
@khaduch
Aug 25 2017 02:20
@lestairon - but that's not an if?
Fernando
@lestairon
Aug 25 2017 02:21
... Right.
I'm still thinking about it as an if
Claudio Restifo
@Marmiz
Aug 25 2017 02:23
@lestairon that's a ternary operation, it's a shortcut for an if statement. The same condition can be expanded in a regular if
Joseph
@Big-jo
Aug 25 2017 02:25
                 <h1>
            <span class="one">Travel</span>
            <span class="two">Buddy</span>
        </h1>
i have this and the colors of each class is different but only class two changed
Ellyria
@Ellyria
Aug 25 2017 02:25
How did you select them, @Big-jo?
Joseph
@Big-jo
Aug 25 2017 02:26
yes i did
Fernando
@lestairon
Aug 25 2017 02:26

Sooo

if (a > b) {
  return 5;
}
else if (b > c) {
  return 10;
}
else {
return 2
}

Is the same as

return a> b? 5 : b > c ? 10 : 2;

So essentially if a is greater then b, return 5, if not, check b is greater than c, return 10 else return 2

Joseph
@Big-jo
Aug 25 2017 02:26
//Style For The Text On The Starting Page

.one
{
    color:blue;
}
.two
{
    color:#e61610;
}
@Ellyria
Ellyria
@Ellyria
Aug 25 2017 02:27
That looks right to me. Maybe Bootstrap has a .one class.
Joseph
@Big-jo
Aug 25 2017 02:29
i tried tha
that
Ellyria
@Ellyria
Aug 25 2017 02:29
What is the color of the two spans if you remove those CSS rules?
Joseph
@Big-jo
Aug 25 2017 02:29
i think i have a solution, but a long one
@Ellyria the color of the first span,black
Gersho
@Gersho
Aug 25 2017 02:30
try !important
Ellyria
@Ellyria
Aug 25 2017 02:30
Does the first span stay black even when the CSS rule is in place?
Joseph
@Big-jo
Aug 25 2017 02:30
yes
Ellyria
@Ellyria
Aug 25 2017 02:31
What happens if you make it #e61610 like the second one?
Joseph
@Big-jo
Aug 25 2017 02:31
nothing
Ellyria
@Ellyria
Aug 25 2017 02:31
Still black?
Aaron Bell
@awb715
Aug 25 2017 02:34
<p id="in" name="a"onclick="redo(0,this.id)">Income</p>
why does the id come in as undefined
Ellyria
@Ellyria
Aug 25 2017 02:36
Where are you seeing undefined?
Aaron Bell
@awb715
Aug 25 2017 02:36
im console.logging this.id in the redo function
Ellyria
@Ellyria
Aug 25 2017 02:36
Interesting. It doesn't show up in my console log.
I put your paragraph element into Firefox and it didn't throw any errors.
I'd put a space before onclick, though.
penguio
@penguio
Aug 25 2017 02:37
@Big-jo try using color: blue !important; because bootstrap might have a class of .one alright made
Aaron Bell
@awb715
Aug 25 2017 02:37
well i have a redo function in javasript that gets called when the paragraph gets clicked
Ellyria
@Ellyria
Aug 25 2017 02:37
Ah. What's the code for the function?
Aaron Bell
@awb715
Aug 25 2017 02:38
function redo(q, id) {
    console.log(id);
    q = Number(q);
    //if the current queston on the page is not the one being clicked we then change it to the one being clicked
    if (q + 1 != iterator) {

        $('.form').load(quest[q], function () {
            $('#p').val(data.income);
        });
        iterator=q+1;
    };
};
Ellyria
@Ellyria
Aug 25 2017 02:38
The good news is that undefined means a variable has been declared, but has not yet been assigned a value. That means you just have to figure out the correct value and it will work.
Aaron Bell
@awb715
Aug 25 2017 02:39
yeah im not sure if p elements can use this.id
what this means is that nothing is getting passed into id
Claudio Restifo
@Marmiz
Aug 25 2017 02:40
@awb715 I fear you cannot pass it as this.id.
You should listen for the event and then get the id from the native event"
<p id="in" name="a"onclick="redo(e , 0)">Income</p>
function redo(e, q) {
 let id = e.target.id;
console.log(id)
};
Joseph
@Big-jo
Aug 25 2017 02:40
<div class="container-fluid">
        <div id="IntroPage">
            <div class="row">
                <div class="col-md-6"> Travel </div>
                <div class="col-md-6"> Buddy </div>
            </div>
        </div>
    <div>
exclusively no idea why this didnt work
Aaron Bell
@awb715
Aug 25 2017 02:42
wow it is working sing this.id @Marmiz @Ellyria
sometimes things just dont work and all of a sudden work
Ellyria
@Ellyria
Aug 25 2017 02:42
Are data and income defined?
Aaron Bell
@awb715
Aug 25 2017 02:42
haha
data.income works
Ellyria
@Ellyria
Aug 25 2017 02:42
Heh.
Aaron Bell
@awb715
Aug 25 2017 02:43
i have been hardcoding this to only work on the p id
but now i can make it dynamic
data.income will be a variable now
i shouldve build this project in vue.js
instead of handlebars.js
Ellyria
@Ellyria
Aug 25 2017 02:44
I have a page that might help with that, @Big-jo: https://codepen.io/Ellyria/full/LLRpEm/
It could be because you'd normally have quotes around the id (if you had manually specified one) and that's not specified in the code.
Aaron Bell
@awb715
Aug 25 2017 02:46
well the id always worked
Ellyria
@Ellyria
Aug 25 2017 02:46
If you put single quotes in, it might work.
Aaron Bell
@awb715
Aug 25 2017 02:46
wasnt the issue
Ellyria
@Ellyria
Aug 25 2017 02:46
Ah, okay.
Aaron Bell
@awb715
Aug 25 2017 02:46
o your supposed to have single quotes?
i dont tihnk that matters
Ellyria
@Ellyria
Aug 25 2017 02:47
Well, you had double quotes around the whole thing, so you'd need single quotes or escaped double quotes inside of them if you wanted some to just go around the id.
Aaron Bell
@awb715
Aug 25 2017 02:47
not sure thats true
Ellyria
@Ellyria
Aug 25 2017 02:47
OMG
Ellyria @Ellyria is an idiot.
Aaron Bell
@awb715
Aug 25 2017 02:47
hehe
noi
noo
Joseph
@Big-jo
Aug 25 2017 02:47
lol
Ellyria
@Ellyria
Aug 25 2017 02:47
The reason your code fell over is because an id cannot start with a number.
Joseph
@Big-jo
Aug 25 2017 02:47
it's still not working
Ellyria
@Ellyria
Aug 25 2017 02:48
The sky will fall if you try it.
penguio
@penguio
Aug 25 2017 02:48
@Big-jo are you using codepen?
Joseph
@Big-jo
Aug 25 2017 02:48
but one is a string
@penguio no
but i can format the code here
penguio
@penguio
Aug 25 2017 02:48
@Big-jo can i see your code, and tell me what's the issue
Joseph
@Big-jo
Aug 25 2017 02:48
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link rel="stylesheet" href="StyleSheet.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
    <script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
</head>
<body>
    <div class="container-fluid">
        <div id="IntroPage">
            <h1>
                <span class='one'>Travel</span>
                <span class="two">Buddy</span>
            </h1>
        </div>
    <div>
</body>
<script src="JavaScript.js" type="text/javascript" charset="utf-8" async defer></script>
</html>
i have two classes in my css with two different colors, only class two is working
Ellyria
@Ellyria
Aug 25 2017 02:50
Can we see the CSS?
Joseph
@Big-jo
Aug 25 2017 02:50
so, when i applied two to the first span, it worked
Ellyria
@Ellyria
Aug 25 2017 02:50
@penguio asked a good question, @Big-jo. Codepen can be a bit picky about how you insert the code.
Joseph
@Big-jo
Aug 25 2017 02:51
.one
{
    color:purple;
}
.two
{
    color:#e61610;
}
penguio
@penguio
Aug 25 2017 02:51
@Big-jo it should work when i add classes myself, they both change
Ellyria
@Ellyria
Aug 25 2017 02:52
This works for me:
<style>
.one {color:red;}
.two {color:green;}
</style>
What else is in your style sheet?
Joseph
@Big-jo
Aug 25 2017 02:53
Thats all i just started the project, and these darn errors
okay i just worked now
Ellyria
@Ellyria
Aug 25 2017 02:54
Yay! What did you change to get it to work?
penguio
@penguio
Aug 25 2017 02:54
:q!
blasted... thought i was typing in vim but nope
Joseph
@Big-jo
Aug 25 2017 02:55
i had a comment at the top of the code :worried:
Ellyria
@Ellyria
Aug 25 2017 02:55
Ah, so you had commented out a rule you wanted to apply?
I think we've all done that at least once.
Joseph
@Big-jo
Aug 25 2017 02:56
i mistakenly used a multi line comment
Ellyria
@Ellyria
Aug 25 2017 02:56
Ah, those can be tricky.
Joseph
@Big-jo
Aug 25 2017 02:56
yup
Aaron Bell
@awb715
Aug 25 2017 02:56
var iterator = 0;
//creates object that gets sent to api
function Obj(name, vale) {
    event.preventDefault(); //prevents pg refresh
    console.log('hit')
    $('.form').load(quest[iterator]);
    //loads next html question to page
    if (name) {
        if (name === "state") {
            vale = usStates[stateConvert(vale)];
            //if its the state, we convert the state name to abbrievation
        }
        data[name] = vale;
        //change or set object value
        console.log(data);
    }


}
var data = {};


//user can click already submitted values to load that orignal question and change it/
function redo(q, id) {
    console.log(id);
    q = Number(q);
    //if the current queston on the page is not the one being clicked we then change it to the one being clicked
    if (q + 1 != iterator) {

        $('.form').load(quest[q], function () {
            $('#p').val(data.income);
        });
        iterator=q+1;
    };
};
is this a bad use case of global variable?
Ellyria
@Ellyria
Aug 25 2017 03:03
No idea, but you're missing a }.
Joseph
@Big-jo
Aug 25 2017 03:06
is there a way to put a div in the middle of a page with css?
i meant bootstrap
penguio
@penguio
Aug 25 2017 03:08
@Big-jo margin: 0 auto;
or you can do center-block or block-center can't remember which one it is
Joseph
@Big-jo
Aug 25 2017 03:09
@penguio thanks
CamperBot
@camperbot
Aug 25 2017 03:09
big-jo sends brownie points to @penguio :sparkles: :thumbsup: :sparkles:
:cookie: 347 | @penguio |http://www.freecodecamp.com/penguio
Lucci Paula
@luccipaula
Aug 25 2017 03:11
@Big-jo margin: 0 auto;, center-block or text-center classes in Bootstrap
Joseph
@Big-jo
Aug 25 2017 03:11
@caixeta-paula thanks
CamperBot
@camperbot
Aug 25 2017 03:11
big-jo sends brownie points to @caixeta-paula :sparkles: :thumbsup: :sparkles:
:cookie: 264 | @caixeta-paula |http://www.freecodecamp.com/caixeta-paula
Lucci Paula
@luccipaula
Aug 25 2017 03:12
And I think sometimes for the margin to work properly, you need to have display: block; :)
No problem
Joseph
@Big-jo
Aug 25 2017 03:13
@caixeta-paula are you sure center-block is a bootstrap class?
Lucci Paula
@luccipaula
Aug 25 2017 03:13
@Big-jo Yes
text-center tends to work better for me in most cases
Claudio Restifo
@Marmiz
Aug 25 2017 03:15
@Big-jo if it's inside a row, you can use offset to "move" the colum of x spaces.
Imagine I have a row and I want a div that takes 6 spaces of the 12 available.
To place it in the center I simply offset it of 3 spaces so that it will stay in the middle.
<div class="container">
  <div class="row">
     <div class="col-xs-6 col-xs-offset-3">
   </div>
...
Joseph
@Big-jo
Aug 25 2017 03:16
@Marmiz Its not in a row
Lucci Paula
@luccipaula
Aug 25 2017 03:17
@Marmiz Can you use offset in place of extra "buffer" divs?
Joseph
@Big-jo
Aug 25 2017 03:17
i mean i want the div to be in the middle horizontal and vertical position
Claudio Restifo
@Marmiz
Aug 25 2017 03:17
@caixeta-paula wym with that?
Joseph
@Big-jo
Aug 25 2017 03:18
i mean i want the div to be in the middle horizontal and vertical position x,y (0,0)
Lucci Paula
@luccipaula
Aug 25 2017 03:18
@Marmiz Extra divs placed on the sides of the main div to center it
Claudio Restifo
@Marmiz
Aug 25 2017 03:20

@caixeta-paula oh. Sure!
that's the preferred way to be honest.

Either you offset with BS, or create your own CSS to center it ( either with gric or flexbox presumably).
But my advice is to never resort to "empty" divs to position other divs.
It gets super tricky because you have to be extra careful about `box-sizing' global properties

Lucci Paula
@luccipaula
Aug 25 2017 03:21
@Marmiz Hmm I didn't know that! Thanks I'll look into those methods!
CamperBot
@camperbot
Aug 25 2017 03:21
caixeta-paula sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1031 | @marmiz |http://www.freecodecamp.com/marmiz
Ellyria
@Ellyria
Aug 25 2017 03:23
No extra divs. That would be considered bad practice.
The less, the merrier.
Maybe that should be the fewer, the merrier.
Lucci Paula
@luccipaula
Aug 25 2017 03:24
@Ellyria Are there any good resources to learn how to create a grid?
Ellyria
@Ellyria
Aug 25 2017 03:24
Yep!
Ellyria @Ellyria rummages around...
Ellyria
@Ellyria
Aug 25 2017 03:25
Here's one with Bootstrap made by yours truly: https://codepen.io/Ellyria/full/LLRpEm/
Here's a roll your own version: https://www.w3schools.com/css/css_rwd_grid.asp
Lucci Paula
@luccipaula
Aug 25 2017 03:26
@penguio @Ellyria Thanks guys!
CamperBot
@camperbot
Aug 25 2017 03:26
caixeta-paula sends brownie points to @penguio and @ellyria :sparkles: :thumbsup: :sparkles:
:cookie: 348 | @penguio |http://www.freecodecamp.com/penguio
:cookie: 504 | @ellyria |http://www.freecodecamp.com/ellyria
Ellyria
@Ellyria
Aug 25 2017 03:26
Also, Khan Academy does a nice job of showing how to do it by floating elements, which is just kind of interesting.
Any time. Definitely do learn to do it the roll your own way one way or another. It's good to also use libraries since you may need to in your career, but nothing beats figuring out how it's done from the bottom up.
Claudio Restifo
@Marmiz
Aug 25 2017 03:28

@caixeta-paula depends a lot on your stacks and specification.
Can you use a library?
Many of them provide a grid system for you.

These days however people tends to run away from big CSS library in favour of using standard "native browser" methods as Flexbox (and probably soon Grid since it has just been declared standard ;) )

Ellyria
@Ellyria
Aug 25 2017 03:29
Ooooh, where's the declaration? I haven't been keeping up with stuff like that lately (got a new job and have been immersing myself in it).
Claudio Restifo
@Marmiz
Aug 25 2017 03:31

@Ellyria
https://drafts.csswg.org/css-grid/

(dated 27 aug 2017)

Lucci Paula
@luccipaula
Aug 25 2017 03:31

@Marmiz I always use Bootstrap but I was leaning on the use of empty divs. I understand the basics of a grid but I didn't know about offset.

I saw a camper on Reddit use his own grid system to create a beautiful tribute page and I was blown away! I didn't even know where to start learning how to do that haha:
https://syknapse.github.io/Tychos-Supernova/

Claudio Restifo
@Marmiz
Aug 25 2017 03:32
Ellyria
@Ellyria
Aug 25 2017 03:33
Nice! Thanks, @Marmiz! I've been a fan of the grid from the moment I discovered it. Responsive design is some of the best fun you can have as an adult.
CamperBot
@camperbot
Aug 25 2017 03:33
ellyria sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1032 | @marmiz |http://www.freecodecamp.com/marmiz
Ellyria
@Ellyria
Aug 25 2017 03:34
If I can grab the corner of my browser and stretch and shrink it and make things happen, I am all kinds of pleased.
Lucci Paula
@luccipaula
Aug 25 2017 03:34
Hahaha
Ellyria @Ellyria realizes this probably also means she's easily entertained...
Claudio Restifo
@Marmiz
Aug 25 2017 03:35
@Ellyria I'm glad people like you exists so I have to do it as fewer as possible ;)
Ellyria
@Ellyria
Aug 25 2017 03:35
Heh, good to know, because responsive design is definitely going to be the area I go into. I've loved CSS from day one, and with it being more and more powerful and important, it's just gotten better.
The Bootstrap home page has some good examples in it, @caixeta-paula.
Of course they've come out with a new version that I haven't learned. I should mess around with that this weekend, because, from what I hear, all the old Bootstrap code won't work in the new version.
Lucci Paula
@luccipaula
Aug 25 2017 03:37
@Ellyria I haven't decided whether I should move onto Bootstrap 4
Ellyria
@Ellyria
Aug 25 2017 03:38
Then you and I should both explore it this weekend and see what we think, @caixeta-paula!
Lucci Paula
@luccipaula
Aug 25 2017 03:38
👍👍
Claudio Restifo
@Marmiz
Aug 25 2017 03:39

I've loved CSS from day one

A rare unicorn.
considering how many library exists to either enhance CSS, or port it entirely in JS

Lucci Paula
@luccipaula
Aug 25 2017 03:40
@Ellyria Btw, how did you discover that "gainsboro" was a color? lol
Ellyria
@Ellyria
Aug 25 2017 03:40
Ah, a long time ago I came across a page that listed all the named colors, so I grabbed a copy of it and have used it over the years. I have some favorites, like gainsboro and dodgerblue.
KatSaldivar
@KatSaldivar
Aug 25 2017 03:41
@khaduch Thanks! It works now for some reason even though I don't think I changed anything.
CamperBot
@camperbot
Aug 25 2017 03:41
katsaldivar sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3238 | @khaduch |http://www.freecodecamp.com/khaduch
Lucci Paula
@luccipaula
Aug 25 2017 03:41
I see, I see
Ellyria
@Ellyria
Aug 25 2017 03:41
There aren't nearly as many named colors as unnamed ones, but sometimes, for a quick piece of code, it's nice to just throw a few names at it.
Ken Haduch
@khaduch
Aug 25 2017 04:03
@KatSaldivar - okay - that's good and you're welcome (even though I didn't do anything much...)
@Ellyria @caixeta-paula - didn't they finally move Bootstrap 4 to "Beta"? That should be more stable, if it's true... It says that there is now Currently v4.0.0-beta
Ellyria
@Ellyria
Aug 25 2017 04:09
Oh, look at that! It seems you still can get the older version. Yesterday the page I was on only showed version 4.0.0. Good. My stuff isn't obsolete yet.
Greg Duncan
@GregatGit
Aug 25 2017 05:26
@Pagnito did you figure out how to save svgs
Pagnito
@Pagnito
Aug 25 2017 05:27
nah, i ended up taking a break and just reading some other stuff for a bit
Greg Duncan
@GregatGit
Aug 25 2017 05:28
@Pagnito are you using your own wepback setup?
Pagnito
@Pagnito
Aug 25 2017 05:29
yea, turned out, the thing i was having trouble with was a z-index thing
tho i do remember react app had an svg, maybe i should start another one and check it out
Greg Duncan
@GregatGit
Aug 25 2017 05:30
@Pagnito when you make your own webpack you have to set up loaders for the different type of files webpack/webpack#595
Pagnito
@Pagnito
Aug 25 2017 05:30
yea i thought that might be it
ill look into it tomorrow, i havea hard time working with create-react-app when i dont know how its working
lfvpCO
@lfvpCO
Aug 25 2017 06:35
best resource to learn JS asap
?
This free book was also a huge help early on: http://eloquentjavascript.net/
lfvpCO
@lfvpCO
Aug 25 2017 06:36
cool
let me check it.
Claudio Restifo
@Marmiz
Aug 25 2017 06:42
Markus Kiili
@Masd925
Aug 25 2017 07:03
@lfvpCO I liked http://speakingjs.com/es5/ (intro part not too good, but deeper stuff is).
Pethaf
@Pethaf
Aug 25 2017 07:13
I browsed through eloquent javascript.
No doubt the author knows his stuff, but I wouldn't recommend it as a beginner resource.
Long Nguyen
@longnt80
Aug 25 2017 07:28
is there any point to use var instead of let?
Gulsvi
@gulsvi
Aug 25 2017 07:29
@longnt80 older browsers don't understand let
That's about it :)
use const everywhere you can, and let everywhere else
Long Nguyen
@longnt80
Aug 25 2017 07:30
@SkyC0der thanks
so var will be obsolete in the future?
CamperBot
@camperbot
Aug 25 2017 07:30
longnt80 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2565 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Aug 25 2017 07:31
Yeah @longnt80 it will be obsolete
Owais Ahmed
@owaisehmed
Aug 25 2017 07:31
@owaisehmed
Need help
https://codepen.io/OwaisEhmed/pen/zdRozE
after clicking on the page links
The css changes
I want it to remain the same
as it is before getting clicked
Gulsvi
@gulsvi
Aug 25 2017 07:31
JavaScript will also be obsolete in the future :)
Long Nguyen
@longnt80
Aug 25 2017 07:32
@SkyC0der shit
Gulsvi
@gulsvi
Aug 25 2017 07:37
@owaisehmed
.navbar-nav > li > a:hover,
.navbar-nav > li > a:focus {
  background-color: #2C3E50;
  color: #18BC9C;
  outline: 0;
}
It's difficult to override default bootstrap styles ^^ That will make your navbar links the same color on hover and focus without the need of !important
If you use bootstrap.js scrollspy or other features, you may need this instead:
.navbar-nav > li > a:hover,
.navbar-nav > li > a:active,
.navbar-nav > li > a.active,
.navbar-nav > li > a:focus {
  background-color: #2C3E50;
  color: #18BC9C;
  outline: 0;
}
Blauelf
@Blauelf
Aug 25 2017 09:48
@SkyC0der This name with rōmaji Sky and katakana tsu ツ is a bit irritating. How should I pronounce that, Sukaitsu? Sukaītsu? Completely different? ROT13 first?
Chris Cullen
@123xylem
Aug 25 2017 10:08
https://cullen-portfolio.herokuapp.com/contact
Anyone know why theres massive gap at bottom on Mobile view?
Apparently its something to do with mobiles using 2 X pixels and so standard height of screen is doubled.. I tried to add a meta tag with viewpoint but it just messed my whole screen up
Thomas Faller
@thomasfaller
Aug 25 2017 10:32
hey guys, I’m doing the Sum All Primes challenge and I’m a bit puzzled by the expected results.
It says that sumPrimes(10) should return 17 but it should not, should it.
All prime numbers including the provider number should add to to 1+3+5+7+10 so that should be 26 no?
Am I missing something?
heroiczero
@heroiczero
Aug 25 2017 10:33
@thomasfaller 10 is not a prime
@thomasfaller 2 is a prime
Thomas Faller
@thomasfaller
Aug 25 2017 10:34
yeah but it’s the provided number
'Sum all the prime numbers up to and including the provided number'
heroiczero
@heroiczero
Aug 25 2017 10:34
@thomasfaller if the provided number is a prime
@thomasfaller so your checking all numbers up to the provided number for prime numbers
Thomas Faller
@thomasfaller
Aug 25 2017 10:36
Then you get the correct sum indeed but it’s not 100% clear the way it’s written.
'Sum all the prime numbers up to and including the provided number’ + 'The provided number may not be a prime.’
to me it doesn’t mean that the included number should be left out fo the addition if not prime.
@heroiczero you’re obviously right but it’s not so clear the way it’s written I guess.
heroiczero
@heroiczero
Aug 25 2017 10:37
@thomasfaller its the range like <= where it is "up to and including the number"
Bryan Reese
@breese8009
Aug 25 2017 10:38
hello JSers!
heroiczero
@heroiczero
Aug 25 2017 10:38
@thomasfaller it can also be up to and not including the number <
Markus Kiili
@Masd925
Aug 25 2017 10:38
@thomasfaller 1 is not a prime according to the given definition of a prime.
Stephen James
@sjames1958gm
Aug 25 2017 10:50
@breese8009 :wave:
Ayush Bahuguna
@relentless-coder
Aug 25 2017 11:37
can someone help me with a nodejs issue?
 User.findById(foundJob.userId)
                              .then((jobUser) => {
                                if (foundJob.userId !== user._id) {
                                  jobUser.activities.unshift(activity);
                                }
                                jobUser.save()
                                  .then((data) => {
                                comEmit.emit('comment', {
                                  userId: foundJob.userId,
                                  room: foundJob.room,
                                  comment: success
                                })
                                    res.status(200).json({
                                      message: 'Comment posted successfully'
                                    })
                                  })
the comment event gets fired multiple times
Amit Patel
@AmitP88
Aug 25 2017 11:39
hey guys, I'm doing the Markdown Previewer project on FCC and I was wondering, since we have to have an input box and an output box, should I use two root divs in my html instead of one? (like one root div with id="input" and one with id="output)
Stephen James
@sjames1958gm
Aug 25 2017 11:39
@AmitP88 I would say no. Have one root div and the parent component that passes data from child to child
@relentless-coder have you put in any console.log to see if findById is getting called more than once?
Amit Patel
@AmitP88
Aug 25 2017 11:40
@sjames1958gm ah ok. so the input component would be the parent of the output component?
Stephen James
@sjames1958gm
Aug 25 2017 11:41
@AmitP88 well it could be I had a parent where one child was the input and the other was the output
Ayush Bahuguna
@relentless-coder
Aug 25 2017 11:41
@sjames1958gm it's getting called just once, also I should let you know this whole code is inside another then block. Is it a promise issue?
Amit Patel
@AmitP88
Aug 25 2017 11:42
@sjames1958gm ah I see. I'll try it that way then. that might be easier. thanks! :)
CamperBot
@camperbot
Aug 25 2017 11:42
amitp88 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8382 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 25 2017 11:42
@AmitP88 :+1:
@relentless-coder If you put a console.log before comEmit.emit line is it only hit once?
Ayush Bahuguna
@relentless-coder
Aug 25 2017 11:44
@sjames1958gm the findById or the comment event? findById is fired just once
Stephen James
@sjames1958gm
Aug 25 2017 11:45
@relentless-coder Put a console.log right before the call to emit and see if it is called more than once.
Ayush Bahuguna
@relentless-coder
Aug 25 2017 11:50
@sjames1958gm just once
Ogundele Olumide
@Lumexralph
Aug 25 2017 11:52
@relentless-coder are you using sequelize ?
@sjames1958gm Hey Bro!
Stephen James
@sjames1958gm
Aug 25 2017 11:53
@Lumexralph hey
Ayush Bahuguna
@relentless-coder
Aug 25 2017 11:53
@Lumexralph mongodb
Markus Kiili
@Masd925
Aug 25 2017 11:53
@Lumexralph Yo!
Ogundele Olumide
@Lumexralph
Aug 25 2017 11:55
@relentless-coder that's the db but what are you using to communicate with it, it looks like sequelize to me that's why i asked cos it's also promise-based
@Masd925 Bro! :smile: good afternoon
@sjames1958gm how're you? seems you guys are still making this place stand :clap: @Masd925
Ayush Bahuguna
@relentless-coder
Aug 25 2017 11:57
@Lumexralph mongoose
Stephen James
@sjames1958gm
Aug 25 2017 11:57
@Lumexralph trying - its much quieter than in the past
Ogundele Olumide
@Lumexralph
Aug 25 2017 11:58
@relentless-coder okay..... haha , promise is still something that requiire deeper study for me... you're in good hands
Ayush Bahuguna
@relentless-coder
Aug 25 2017 11:59
I don't think that it's promise issue, it could be nodejs issue too, because everything else gets triggered just once
Ogundele Olumide
@Lumexralph
Aug 25 2017 11:59
@sjames1958gm yeah I noticed, to be honest, there's hardly any time like i used to
@relentless-coder are you saying nodejs triggered the event more than once?
Ayush Bahuguna
@relentless-coder
Aug 25 2017 12:00
@Lumexralph yes
Ogundele Olumide
@Lumexralph
Aug 25 2017 12:00
without a reason to?
Ayush Bahuguna
@relentless-coder
Aug 25 2017 12:00
@Lumexralph maybe I don't know EventEmitter module so well
Ogundele Olumide
@Lumexralph
Aug 25 2017 12:00
@relentless-coder that's weird, some event might have caused it
Ayush Bahuguna
@relentless-coder
Aug 25 2017 12:01
@Lumexralph but there is only event in that piece of code.
Markus Kiili
@Masd925
Aug 25 2017 12:02
@Lumexralph What are you doing nowadays?
Ogundele Olumide
@Lumexralph
Aug 25 2017 12:02
@relentless-coder I'm yet to use mongoose so don't think I can really help but what I can say is, if it get's triggered more than once an event is a likely culprit
@Masd925 asides work, I have been busy with nodeJS and MongoDB, express building a web app and that required so much to be learnt
Markus Kiili
@Masd925
Aug 25 2017 12:09
@Lumexralph ok. That JS backend world interests me too, but I think I have to make something with Java and mySQL before delving into new things. Need something for my portfolio.
Ogundele Olumide
@Lumexralph
Aug 25 2017 12:12
@Masd925 there's an app i am building presently which I am implementing all those technologies into as i learn them and making it look like a pro work, that's where I'm doing so much learning these days
@Masd925 then get to work
@Masd925 but C++ is a powerful language, I wish i'll have a clean mind-desk to learn it sooner
Markus Kiili
@Masd925
Aug 25 2017 12:15
@Lumexralph Tough language, but lots of work there too.
Stephen James
@sjames1958gm
Aug 25 2017 12:19
C++ jobs are harder to find than c#, java backend, etc.
Ogundele Olumide
@Lumexralph
Aug 25 2017 12:29
@sjames1958gm really? but some good technologies are built using C++
Chris Juchtmans
@kjuchtmans
Aug 25 2017 12:31
afternoon brave new coders (and old) ! :wave:
Stephen James
@sjames1958gm
Aug 25 2017 12:35
@kjuchtmans :wave:
Kelechi Chinaka
@ke1echi
Aug 25 2017 12:35
:wave: guys
Stephen James
@sjames1958gm
Aug 25 2017 12:35
@Lumexralph Yes, but not a lot of job postings relative to the others.
@kelechy :wave:
Chris Juchtmans
@kjuchtmans
Aug 25 2017 12:35

Question re: Object.setPrototypeOf() vs bind() : why does my cat not meow below?

code:

let talk = function() {
  console.log(this.sound)
}

let animal = {
  talk
}

let dog = {
  sound : "woof"
}

let cat = {
  sound: "meow"
}

Object.setPrototypeOf(dog, animal)
dog.talk()
//returns  "woof'

cat.talk.bind(animal)
//returns 'undefined'
Stephen James
@sjames1958gm
Aug 25 2017 12:36
cat doesn't have a talk property
@kjuchtmans I thought bind - was for binding parameters to functions.
Chris Juchtmans
@kjuchtmans
Aug 25 2017 12:37
and dog does, because it was added to its prototype?
Stephen James
@sjames1958gm
Aug 25 2017 12:37
@kjuchtmans yes
Chris Juchtmans
@kjuchtmans
Aug 25 2017 12:37
@sjames1958gm if I can bind a param to a function, shouldn't I be able to bind a function to a function as well?
alpox
@alpox
Aug 25 2017 12:37
@Lumexralph companies mostly only use C++ when they need low-level code where they need direct memory control. This is because higher level languages like java or C# give you a lot more safety for your program. With C++ you can easily create very bad memory leaks and its often hard to track who ones which memory. This makes the use of it viable only if the company really needs it and if they do, they want very competent people for it which can handle it right
Stephen James
@sjames1958gm
Aug 25 2017 12:38
@alpox That is not true.
@alpox Chrome for one is written in C++ and not for low-level code
@kjuchtmans I suppose that would make the this reference in the function another function
Chris Juchtmans
@kjuchtmans
Aug 25 2017 12:41
@sjames1958gm right, thanks
CamperBot
@camperbot
Aug 25 2017 12:41
kjuchtmans sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8383 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ogundele Olumide
@Lumexralph
Aug 25 2017 12:41
@kjuchtmans bind returns another function and since functions can be passed around just like a value you should be able to bind a function
@alpox guess no learning C++ for me then @kelechy Bro, whats up
alpox
@alpox
Aug 25 2017 12:43
@sjames1958gm which part is not true?
Chris Juchtmans
@kjuchtmans
Aug 25 2017 12:43
@Lumexralph my thought exactly. doesn't that imply that using bind () I should be able to achieve what setPrototypeOf () does, as well?
Kelechi Chinaka
@ke1echi
Aug 25 2017 12:49
brotherly... everyday is a learning day @Lumexralph
hows it going with u @Lumexralph
alpox
@alpox
Aug 25 2017 12:50
@sjames1958gm if you mean that they also use it a lot for higher level stuff.. Im aware that they sometimes do. But still most companies prefer higher level languages for such things
Chris Juchtmans
@kjuchtmans
Aug 25 2017 12:52
@Lumexralph yup. I think this proves it - both calls below return 'woof'. Good doggy.
code:
let talk = function() {
  console.log(this.sound)
}

let animal = {
  talk
}

let dog = {
  sound : "woof"
}

Object.setPrototypeOf(dog, animal)
dog.talk()
//returns "woof"

dog.bark = talk.bind(dog)
dog.bark()
//also returns "woof"
Stephen James
@sjames1958gm
Aug 25 2017 12:54
@alpox that c++ is only used for low level code. Qt an application development platform is almost all C++
Ogundele Olumide
@Lumexralph
Aug 25 2017 12:57
@kjuchtmans i don't think so, the [[prototype]] is involved when it has to do with setPrototypeOf
@kjuchtmans i think so
@kelechy in backside.....
alpox
@alpox
Aug 25 2017 12:59
@sjames1958gm ah, yes :) im aware of that. Thats why i said "mostly"
Kelechi Chinaka
@ke1echi
Aug 25 2017 13:01
i cant wait to start doing backend stuffs @Lumexralph
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:02
@kelechy it can be overwhelming but learning new stuffs can be like that....
Kelechi Chinaka
@ke1echi
Aug 25 2017 13:03
yea.., true @Lumexralph
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:03
@kelechy i find it more interesting compared to frontend
Kelechi Chinaka
@ke1echi
Aug 25 2017 13:03
really @Lumexralph
i prefer algos and data structure
but dunno why it should be placed :smile:
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:05
@kelechy :smile: all those are part of the building blocks of backside
Kelechi Chinaka
@ke1echi
Aug 25 2017 13:05
oh interesting :smile:
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:06
@kelechy you have to use algorithms in callbacks that'll be used for handling asynchronous events and also you deal with data mostly in backside
Chris Cullen
@123xylem
Aug 25 2017 13:08
<% if (window.outerWidth >960px) { %>
            <ul class="navbar-right">
                <li style=" list-style:none; margin-top: 1.5rem; margin-right:2rem; font-size:1.2rem ">    <em>SEO & Web Dev Professional</em>   </li>

            </ul>
            <% } %>
Can someone help me with this navbar setting.. Im getting unexpected identifier error with this. DO i have to define window or something?
_
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:09
@123xylem is it jade?
Chris Cullen
@123xylem
Aug 25 2017 13:09
@Lumexralph ejs
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:09
@123xylem frontend?
Chris Cullen
@123xylem
Aug 25 2017 13:10
@Lumexralph its for front end display
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:10
@123xylem what's ejs, please?
Chris Cullen
@123xylem
Aug 25 2017 13:10
I want to show that nav only if width of screen is high enough
just a html page that can take JS code aswell
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:10
@123xylem what's the error message?
Chris Cullen
@123xylem
Aug 25 2017 13:11
SyntaxError: Unexpected identifier in /home/ubuntu/workspace/Portfolio/views/contact.ejs while compiling ejs
unexpected identifier on whatever page i load
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:11
@123xylem it should point you to a line in the code
@123xylem might be a curly brace or symbol issue
@123xylem check the line the error emerged from that'll narrow it down
@123xylem i don't know ejs but with the experience I have had with errors, it always point to the line ....
Chris Cullen
@123xylem
Aug 25 2017 13:15
it says line 1 on every page i load... the only extra code I used is that stuff
I dont know if it just doesnt recognise window.width
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:16
@123xylem it will tell you undefined if that's window issue I thnk
Kelechi Chinaka
@ke1echi
Aug 25 2017 13:16
hows your day looking like @Lumexralph
heard of oss @Lumexralph
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:19
@123xylem ejs is complaining about your code being against its rule.... so maybe you take a closer look at that, if I knew ejs I could help
@kelechy what's that ?
Kelechi Chinaka
@ke1echi
Aug 25 2017 13:19
ossu i think
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:19
@kelechy meaning?
Kelechi Chinaka
@ke1echi
Aug 25 2017 13:20
open source society uni
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:21
@kelechy yeap
Kelechi Chinaka
@ke1echi
Aug 25 2017 13:21
o cool
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:21
@kelechy forked one of their repo
Kelechi Chinaka
@ke1echi
Aug 25 2017 13:21
u started? @Lumexralph
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:22
@kelechy i would create time for it when I have space but it looks cool
@kelechy hoping I can start soon but need to clear my desk, I don't like unfinished projects, like to bite what I can chew
Kelechi Chinaka
@ke1echi
Aug 25 2017 13:23
very true :smile: @Lumexralph
Ahmed raza
@Raza403
Aug 25 2017 13:23
Hi I have a little question here is link of "Local weather app" I am using FCC's api, data is recieved from api. I can even console.log all json data and one key like "temp" (You can see I am doing it in code) but data is not being displayed in my html.
So the simple question is how can I display json keys in my html data
If you look at console portion you will see I have recieved all the data
But failed to display it in html
Any help???
Ogundele Olumide
@Lumexralph
Aug 25 2017 13:29
@Raza403 have you checked the browser console?
Ahmed raza
@Raza403
Aug 25 2017 13:29
yes same results
Blauelf
@Blauelf
Aug 25 2017 13:32
403 for me feels the same as "Forbidden". Had too much HTTP, I guess.
Ahmed raza
@Raza403
Aug 25 2017 13:33
@Blauelf I can render the JSON only problem is in showing it in html
Blauelf
@Blauelf
Aug 25 2017 13:35

@Raza403 Instead of

$("#data").html = "<p>" + data.main.temp + "</p>";

you could try

$("#data").html("<p>" + data.main.temp + "</p>");

Vanilla JS version would be

document.getElementById("data").innerHTML = "<p>" + data.main.temp + "</p>";

you might have confused those two.

Ahmed raza
@Raza403
Aug 25 2017 13:38
let me try
@1ba1 It solved the problem.
@Blauelf Thanks a lot
CamperBot
@camperbot
Aug 25 2017 13:39
raza403 sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4580 | @blauelf |http://www.freecodecamp.com/blauelf
Jefferson
@jeffersonnnn
Aug 25 2017 13:55

Hi guys, i need a little help. I am in the seek and destroy challenge seeking to turn arguments objects into an array. To do this, i have used
```js

function destroyer(array) {
var argsToArray = array.slice.call([1, 2, 3, 1, 2, 3], 2, 3);
return argsToArray;

}

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

``

Does it pass muster? Did i go about that the right way?

Blauelf
@Blauelf
Aug 25 2017 13:55
@jeffersonnnn You meant array.slice.call(arguments)?
Jefferson
@jeffersonnnn
Aug 25 2017 13:55

Hi guys, i need a little help. I am in the seek and destroy challenge seeking to turn arguments objects into an array. To do this, i have used


function destroyer(array) {
  var argsToArray = array.slice.call([1, 2, 3, 1, 2, 3], 2, 3);
  return argsToArray;

}

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

Does it pass muster? Did i go about that the right way?

Stephen James
@sjames1958gm
Aug 25 2017 14:00
@jeffersonnnn Put arguments in the call don't copy the input
array.slice.call(arguments)
Jefferson
@jeffersonnnn
Aug 25 2017 14:00
@Blauelf so arguments instead of the function arguments?
Blauelf
@Blauelf
Aug 25 2017 14:01
@jeffersonnnn arguments is an array-like object containing all the arguments passed to the current function.
Markus Kiili
@Masd925
Aug 25 2017 14:01
@jeffersonnnn It is clearer to use the function from where it really comes from, so var argsToArray = Array.prototype.slice.call(arguments);
Stephen James
@sjames1958gm
Aug 25 2017 14:02
@jeffersonnnn Yes, arguments holds the values.
Jefferson
@jeffersonnnn
Aug 25 2017 14:03
@sjames1958gm @Masd925 @Blauelf thanks guys. Y'all rock.
CamperBot
@camperbot
Aug 25 2017 14:03
jeffersonnnn sends brownie points to @sjames1958gm and @masd925 and @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4581 | @blauelf |http://www.freecodecamp.com/blauelf
:star2: 4438 | @masd925 |http://www.freecodecamp.com/masd925
:star2: 8384 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 25 2017 14:03
@jeffersonnnn :+1:
Blauelf
@Blauelf
Aug 25 2017 14:04
arguments is not only array-like, but also iterable. So in ES6, one can say let argsToArray = [...arguments], or define a rest argument in the function signature, like function destroyer(array, ...targets) (the rest argument is an array containing all the extras after the other named parameters have been filled).
I really like those parts of ES6, I really have a lot of use for those. Less for proxies, generators or promises.
Markus Kiili
@Masd925
Aug 25 2017 14:14
@Blauelf I didn't understand those benefits until I saw some algorithm solutions on Codewars. Much simpler on ES6.
Blauelf
@Blauelf
Aug 25 2017 14:15
Which benefits? Promises?
Markus Kiili
@Masd925
Aug 25 2017 14:15
@Blauelf Rest and spread and arrow functions.
Blauelf
@Blauelf
Aug 25 2017 14:19
Even seek&destroy, using rest parameters like
const destroyer = (arr, ...targets) => arr.filter((elem) => !targets.includes(elem));
Or the largest numbers in arrays, featuring spread operator
const largestOfFour = (arr) => arr.map((subArr) => Math.max(...subArr));
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:36
hi everone
Jason Luboff
@JLuboff
Aug 25 2017 15:36
Hello
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:36
when i connect js with html
by
<script src="script.js"></script>
Christopher McCormack
@cmccormack
Aug 25 2017 15:36
@JLuboff :wave:
Jason Luboff
@JLuboff
Aug 25 2017 15:37
@cmccormack Hey, how's it going?
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:37
the js doesn't connect
why ?
Jason Luboff
@JLuboff
Aug 25 2017 15:37
@IKing4ever1 Is script.js in the same folder as your html file?
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:37
yes
my index is php
index.php
Christopher McCormack
@cmccormack
Aug 25 2017 15:37
@JLuboff stupid busy with work this week, I hate the after-vacaction-but-before-holiday-freeze time :D
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:38
so what's the problem ?
Jason Luboff
@JLuboff
Aug 25 2017 15:38
@IKing4ever1 and the filename is written correctly?
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:38
i put the code in the end of the page
yes
Jason Luboff
@JLuboff
Aug 25 2017 15:39
@cmccormack Fun! I just had a cold call from HP and the rep kept trying to get me to talk about our infastructure and I kept telling her I didn't want to and that we're good with your infastructure... she was stammering trying to keep the call going
:joy:
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:39
can anyone help me ?
Christopher McCormack
@cmccormack
Aug 25 2017 15:39
@JLuboff we're they trying to sell you site services?
Ronique Ricketts
@RoniqueRicketts
Aug 25 2017 15:39
hey nerds how's it going?
Ahmed raza
@Raza403
Aug 25 2017 15:39
Hi can any one help me my code is not getting json from FCC weather API, While the same code was working an hour before, was displaying data in console. here is the link https://codepen.io/raza403/pen/vJaqbV
Jason Luboff
@JLuboff
Aug 25 2017 15:40
@cmccormack I'm not too sure what they were trying to sell me, I just knew we wouldn't buy it so I didn't want my time or her time wasted. But she kept pushing. And I didn't want to be rude and hang up but ugh.
@IKing4ever1 Did you check your dev console to see if there are any errors?
Christopher McCormack
@cmccormack
Aug 25 2017 15:40
@IKing4ever1 maybe you can provide some context, all you have told us is you added a script. Is it not working? have you checked your dev console to see if there are any errors loading it, or the Dev network section to make sure your js file loaded?
Ronique Ricketts
@RoniqueRicketts
Aug 25 2017 15:40
@Raza403 is your location on? It show in my console. I am using firefox
Jason Luboff
@JLuboff
Aug 25 2017 15:40
@RoniqueRicketts Doing alright, yourself?
Christopher McCormack
@cmccormack
Aug 25 2017 15:41
@RoniqueRicketts heya
Ronique Ricketts
@RoniqueRicketts
Aug 25 2017 15:41
@JLuboff I am here at work sneaking some coding in :trollface:
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:41
how i can check my dev console
:D
Jason Luboff
@JLuboff
Aug 25 2017 15:41
@Raza403 It's working fine for me
Ronique Ricketts
@RoniqueRicketts
Aug 25 2017 15:41
@cmccormack wazzup chris?
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:41
i use xxamp to run js
Jason Luboff
@JLuboff
Aug 25 2017 15:41
@IKing4ever1 If on windows, most browsers you can hit F12 to open it
Ronique Ricketts
@RoniqueRicketts
Aug 25 2017 15:41
@IKing4ever1 right click on your webpage and go to inspect
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:42
:D
Jason Luboff
@JLuboff
Aug 25 2017 15:42
@IKing4ever1 Ok, so there you go, you have an error in your JS
@cmccormack Finished my Stock Chart app the other day if you want to check it out: http://stockapp-jluboff.glitch.me/
Christopher McCormack
@cmccormack
Aug 25 2017 15:43
@sarthakcoder did you review the examples?
Ahmed raza
@Raza403
Aug 25 2017 15:43
@JLuboff i don't know why it is not working for me, on both code pen and local server
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:43
what's the problem
?
Jason Luboff
@JLuboff
Aug 25 2017 15:44
@Raza403 Make sure you're loading over https and accepting the geolocation?
Christopher McCormack
@cmccormack
Aug 25 2017 15:44
@JLuboff that looks great!
@JLuboff are you using d3?
Jason Luboff
@JLuboff
Aug 25 2017 15:44
@cmccormack Oh I see you're playing with it :D
No, chart.js but D3 looks amazing
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:45
are there any problem here ?
Christopher McCormack
@cmccormack
Aug 25 2017 15:45
I've been using d3 recently, pretty fun. However, trying to integrate it with React has been a bit more challenging
Jason Luboff
@JLuboff
Aug 25 2017 15:45
@IKing4ever1 Just becuase someone doesn't respond in less than a minute, doesn't mean you need to keep asking the same thing
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:46
sry
...
Ronique Ricketts
@RoniqueRicketts
Aug 25 2017 15:46
@sarthakcoder first access the name of the object, then call the innerobject which is car then call the first object of car and the last one which is glove box has to be in brackets
Christopher McCormack
@cmccormack
Aug 25 2017 15:46
@IKing4ever1 it depends, do you have an element with id='header' in your index?
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:47
yes
<h1 id="header">Hello Js Test</h1>
Ahmed raza
@Raza403
Aug 25 2017 15:47
@JLuboff I am doing both of these
Moisés Man
@moigithub
Aug 25 2017 15:48
linked ur js file to ur php ?
at top or bottom? @IKing4ever1
Christopher McCormack
@cmccormack
Aug 25 2017 15:48
@JLuboff didn't realize it was updating when others used it, sorry for deleting some haha
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:48
bottom
Jason Luboff
@JLuboff
Aug 25 2017 15:48
@cmccormack I think I saw someone else say that integrating it with React was difficult, that or it was for chart.js, can't remember
@cmccormack Nope, thats the point! It's using web sockets
Christopher McCormack
@cmccormack
Aug 25 2017 15:49
@JLuboff React and D3 kind of do the same thing, so to use React I'm using D3 to process the data but React to display it
Jason Luboff
@JLuboff
Aug 25 2017 15:49
Gotcha. Once I finish Backend I'll head over to Data viz
Suhail Bahawi
@IKing4ever1
Aug 25 2017 15:49
this is the page
Ronique Ricketts
@RoniqueRicketts
Aug 25 2017 15:50
@JLuboff so is it better to do backend before data vis?
Jason Luboff
@JLuboff
Aug 25 2017 15:51
@RoniqueRicketts You'd probably benefit more from doing data viz first, but I have a more pressing need to know backend so thats why I went that route. Either way, the FCC content for both (in its current iteration) is lacking
Ronique Ricketts
@RoniqueRicketts
Aug 25 2017 15:52
@JLuboff I know its lacking. I just use it as a curriculum guide
Christopher McCormack
@cmccormack
Aug 25 2017 15:53
@JLuboff Can I make a suggestion? Maybe bind your add click action to an enter keyboard event if the input is focused and not empty?
Gulsvi
@gulsvi
Aug 25 2017 15:54
@Blauelf I hadn't thought of how it might translate lol, hopefully nothing bad. Just meant to be a smile, (or half a shrug!) ¯\(ツ)
Christopher McCormack
@cmccormack
Aug 25 2017 15:54
I don't really think Data Viz is a requirement, but it's a good tool to have in your belt
D3 is pretty powerful when presenting data, and the syntax is pretty straight forward
Jason Luboff
@JLuboff
Aug 25 2017 15:55
@cmccormack I tried...and for some reason it wouldn't work? I tried with both jQuery and vanilla. Neither would work for some reason (and I know atleast my jQuery method works becuase I used it in my previous app) so I said forget it :joy:
Christopher McCormack
@cmccormack
Aug 25 2017 15:56
@JLuboff you could turn that section into a form and bind it to the submit action I believe
For my wiki page I did this:
  $('#form-search').submit(function(event) {
    event.preventDefault();
    searchButtonClick();
  });
Jason Luboff
@JLuboff
Aug 25 2017 15:57

@cmccormack I might try that then. This is what I was using

$("#city").keypress(function(e) {
        if (e.which === 13) {
          $("#location").trigger('click');
        }
      });

(Except city and location are different IDs, this is from my nightlife app)

I now that I think about it...I might have been adding an e.preventDefault() which perhaps was an issue..
Christopher McCormack
@cmccormack
Aug 25 2017 15:58
I've not used trigger
Jason Luboff
@JLuboff
Aug 25 2017 15:59
If I remember correctly, trigger just enables the "click" to occur which then should fire off the actual event listerner
Christopher McCormack
@cmccormack
Aug 25 2017 16:01
I thought you could just do .click() but I can't remember.
probably does the same if it does work
Jason Luboff
@JLuboff
Aug 25 2017 16:01
I did just realize I didn't handle when an user tries to input a stock thats already present. I mean, it doesn't add it again, but I don't display a message
Christopher McCormack
@cmccormack
Aug 25 2017 16:02
@JLuboff It doesn't seem to like Berkshire Hathaway
Jason Luboff
@JLuboff
Aug 25 2017 16:02
Ya I'd have to check, but I know that above code works for my nightlife app without having the input/button be a form
Christopher McCormack
@cmccormack
Aug 25 2017 16:02
probably best to avoid forms :D
Does make a submit bind a bit easier though
Jason Luboff
@JLuboff
Aug 25 2017 16:03
@cmccormack Ya I'm not actually 100% sure on what stocks are valid (I get them through Quandl's api). I'm not very familar with stocks in the first place so that doesn't help either
Christopher McCormack
@cmccormack
Aug 25 2017 16:03
@SkyC0der it's not the closed fist of the right hand?
Gulsvi
@gulsvi
Aug 25 2017 16:04
haha, nope! @cmccormack
:fist:
Christopher McCormack
@cmccormack
Aug 25 2017 16:04
looks exactly the same @SkyC0der
:D
Just with the thumb out
Blauelf
@Blauelf
Aug 25 2017 16:05

@SkyC0der ツ is a syllable in the katakana alphabet, the tsu syllable. Those don't have meaning on their own (kanji, the Chinese characters imported to Japan, have some meaning, but could have different pronunciation depending on the word they're in).

ツ for example is used in クリスマスツリー (kurisumasutsurii - christmas tree)

Gulsvi
@gulsvi
Aug 25 2017 16:05
Yeah, katakana for borrowed words :)
I never thought of su ka i tsu or something like that
Could have been more clever with my name!
Pethaf
@Pethaf
Aug 25 2017 16:08
Just use romanji, make your life simple.
Blauelf
@Blauelf
Aug 25 2017 16:08
BTW, gingerbread in the スーパー (supermarket) here in Germany starting this week. Christmas is early this year. From the shelves, I'd say in October.
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:08
anyone can help me
Blauelf
@Blauelf
Aug 25 2017 16:08
@IKing4ever1 Post questions, not meta-questions, and you'll know.
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:08
js donsn't connect with html
Blauelf
@Blauelf
Aug 25 2017 16:08
Details, please.
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:08
    <script src="script.js"></script> 
Blauelf
@Blauelf
Aug 25 2017 16:09
You have script.js in the same directory?
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:09
the problem in google chrome
yes ..
the problem...
i don't know why
all codes is currect
Christopher McCormack
@cmccormack
Aug 25 2017 16:10
@IKing4ever1 try using <script type="text/javascript" src="script.js"></script> and see if that helps
Blauelf
@Blauelf
Aug 25 2017 16:10
That's two errors.
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:10
ok
Christopher McCormack
@cmccormack
Aug 25 2017 16:11
Their code is above, I don't see anything that stands out wrong
Blauelf
@Blauelf
Aug 25 2017 16:11
@IKing4ever1 Any non-matching parentheses/curly braces in script.js?
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:11
the same problem
Pethaf
@Pethaf
Aug 25 2017 16:11
@cmccormack Actually with HTML5 you don't have to specify the type.
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:12
@Blauelf no
this is the js file : http://prntscr.com/gcyzqo
Moisés Man
@moigithub
Aug 25 2017 16:12
test ur js code inside the same php file (instead of external file)
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:12
and this is the php file : http://prntscr.com/gcyzww
ok let me try
it's run when i put it in the same file....
Blauelf
@Blauelf
Aug 25 2017 16:14
@IKing4ever1 Wait. The browser is complaining about line 12 of script.js. The file you show does not have line 12.
Christopher McCormack
@cmccormack
Aug 25 2017 16:14
yeah that's curious - @IKing4ever1 click the link to your script file in the console error
and send us a screenshot
script.js:12
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:15
yes
ok 1m
Moisés Man
@moigithub
Aug 25 2017 16:15
...probably loading from cache ?
(rename the file )
Blauelf
@Blauelf
Aug 25 2017 16:16
Either cache, or multiple files of same name.
I sometimes confuse test sytem with productive system :P
Christopher McCormack
@cmccormack
Aug 25 2017 16:17
None of my systems are productive :D
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:17
oh
thanks everone
everyone *
when i change the file name
the problem is gone
Abhinav Mishra
@abhinav-m
Aug 25 2017 16:17
wow..
is this a common problem?
Christopher McCormack
@cmccormack
Aug 25 2017 16:18
@IKing4ever1 do you have multiple script.js files in that same directory like @Blauelf suggested?
Blauelf
@Blauelf
Aug 25 2017 16:21
@abhinav-thinktank Caching problems? Sure. You want to have the cache duration as high as possible to reduce server load, and at the same time have it as low as possible to have changes reflected immediately. On productive systems, changes are rare, so high values, but when changes are required... (sometimes purge caches, or even restart the servers to have them re-read their configuration immediately)
Abhinav Mishra
@abhinav-m
Aug 25 2017 16:22
aah , ok @Blauelf thanks for the explanation
CamperBot
@camperbot
Aug 25 2017 16:22
abhinav-thinktank sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4582 | @blauelf |http://www.freecodecamp.com/blauelf
Abhinav Mishra
@abhinav-m
Aug 25 2017 16:22
@cmccormack :wave:
Christopher McCormack
@cmccormack
Aug 25 2017 16:22
in Chrome if you have the developer tools open, you can long-press the reload button on a page and it gives you the option to reload and clear the cache
@abhinav-thinktank hiya :wave:
Blauelf
@Blauelf
Aug 25 2017 16:23
Oh, right, there's also browser cache. I thought more about the web server, which has its own cache.
I usually use Ctrl+Shift+R to reload the page without using the files stored in browser cache.
Jason Luboff
@JLuboff
Aug 25 2017 16:25
Ctrl+F5 is what I use
Christopher McCormack
@cmccormack
Aug 25 2017 16:26
Nice always learning, thanks @JLuboff and @Blauelf
CamperBot
@camperbot
Aug 25 2017 16:26
cmccormack sends brownie points to @jluboff and @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 2169 | @jluboff |http://www.freecodecamp.com/jluboff
:star2: 4583 | @blauelf |http://www.freecodecamp.com/blauelf
Jason Luboff
@JLuboff
Aug 25 2017 16:27
:+1:
Pieter Stokkink
@forkerino
Aug 25 2017 16:35
@cmccormack alternatively you can check the 'disable cache' checkbox in the network tab in devtools and then, whenever the devtools are open, every refresh is a hard refresh.
Hey hey people!
Christopher McCormack
@cmccormack
Aug 25 2017 16:36
@forkerino hiya!
Jason Luboff
@JLuboff
Aug 25 2017 16:36
Hola!
Christopher McCormack
@cmccormack
Aug 25 2017 16:36
how's it going?
Pieter Stokkink
@forkerino
Aug 25 2017 16:36
Goooood! I have very little time these days, but am loving the coding job.
How are you all?
Jason Luboff
@JLuboff
Aug 25 2017 16:37
Doing alright...taking a microsoft certification on monday fun stuff
Pieter Stokkink
@forkerino
Aug 25 2017 16:38
what kind of cert?
Jason Luboff
@JLuboff
Aug 25 2017 16:38
For this one, its MTA (Microsoft Technology Associate?) IT Infastructure with a focus on Server Administration
Pieter Stokkink
@forkerino
Aug 25 2017 16:39
ah, ok. For your job, I presume?
Jason Luboff
@JLuboff
Aug 25 2017 16:40
Yup, I'll get a healthy raise assuming I pass as well
Pieter Stokkink
@forkerino
Aug 25 2017 16:40
Nice!
Christopher McCormack
@cmccormack
Aug 25 2017 16:41
@forkerino what tech have you been working on recently?
Pieter Stokkink
@forkerino
Aug 25 2017 16:43
I've been deep diving into angular for work, got a decent grasp of it now, getting pretty good at redux sagas, and in my spare time I've been learning more Elixir and some Solidity (Ethereum programming).
Christopher McCormack
@cmccormack
Aug 25 2017 16:44
@forkerino I know some of those words! Sounds like fun
to some, at least haha
Pieter Stokkink
@forkerino
Aug 25 2017 16:46
lol
Christopher McCormack
@cmccormack
Aug 25 2017 16:46
@forkerino doing any blog posts while you learn?
Pieter Stokkink
@forkerino
Aug 25 2017 16:48
nah, only thing I write is code and direct communication (here, mail, inter-office stuff). Ain't got so much time to write.
What are you building, @cmccormack
?
Christopher McCormack
@cmccormack
Aug 25 2017 16:49
@forkerino been super busy with work so just slowly going through the D3 projects but using React
Currently on the Force Directed Graph
Pethaf
@Pethaf
Aug 25 2017 16:50
@forkerino Did you also have an epiphany?
Pieter Stokkink
@forkerino
Aug 25 2017 16:50
ok, I haven't made much progress in the past weeks. Still building the game of life (I spend some time on it two weeks ago and got it to display a random block of cells and hooked up some Redux actions, etc.).
Pethaf
@Pethaf
Aug 25 2017 16:50
That behind all the complexity, angular isn't that complicated.
All it is is components, modules and providers.
Pieter Stokkink
@forkerino
Aug 25 2017 16:52
@Pethaf It is not too bad, but I don't like that it has a tendency to couple code if you don't look out. The codebase I'm working on has gone a bit down the wrong road in that regards, which we are fixing now. I must say that using redux for managing state really clears everything up and makes the code a LOT more readable.
Christopher McCormack
@cmccormack
Aug 25 2017 16:53
@forkerino I liked that one but I feel like I don't understand React well enough to make it more efficient.
Pethaf
@Pethaf
Aug 25 2017 16:53
Ok.
Haven't worked with redux.
silver537
@silver537
Aug 25 2017 16:54
I hope vue gets recognized as a liable framework for the market.
Pethaf
@Pethaf
Aug 25 2017 16:54
Doesn't redux couple to react.
Christopher McCormack
@cmccormack
Aug 25 2017 16:54
If there is anything I want to focus on right now it's efficiency within React. Maybe that just means understanding the framework better
Pethaf
@Pethaf
Aug 25 2017 16:54
I was wrong.
Redux seems to be framework agnostic.
Pieter Stokkink
@forkerino
Aug 25 2017 16:54
@Pethaf It is often used in combination with react, but it is a library you can use independently
@silver537 I think there will be some companies using it. There are already quite popular meetup groups around here solely focused on Vue, so there is definitely a chance. :)
Pethaf
@Pethaf
Aug 25 2017 16:57
@forkerino That is why I am starting to fear web dev.
Seems there is a new technology every other week
Christopher McCormack
@cmccormack
Aug 25 2017 16:57
I still haven't forced myself to adopt Redux hah
@Pethaf nothing wrong with new tech. It will always change, just need to be comfortable adapting
Suhail Bahawi
@IKing4ever1
Aug 25 2017 16:58
anyone know php help group >
?
Pieter Stokkink
@forkerino
Aug 25 2017 16:58
@Pethaf It is not so much about the frameworks, but more about the underlying philosophy. If you understand the language well, you can learn any framework quickly.
silver537
@silver537
Aug 25 2017 16:59
Yea but most of the market is angular and react. -_-
Pethaf
@Pethaf
Aug 25 2017 16:59
I should stop wasting time on reddit.
Christopher McCormack
@cmccormack
Aug 25 2017 17:00
@Pethaf yeah you probably should :) it's like eating candy for dinner
Blauelf
@Blauelf
Aug 25 2017 17:00
@Pethaf Tales from tech support?
aRtoo
@artoodeeto
Aug 25 2017 17:00
whats good fam! just wanted to ask. is this called cheating?? on my algo problem it wasnt stated that i should use parseIntbut i did. to conver the binary to charCode. and you have another solution for this algo?? heres the code:

function binaryAgent(str) {

  str = str.split(' ');
  var binVal = [];
   var parseVal; 

  for(var i=0; i<str.length; i++) {
    parseVal = parseInt(str[i],2);

    binVal.push(String.fromCharCode(parseVal));
  }

  return binVal.join('');

}
Jason Luboff
@JLuboff
Aug 25 2017 17:01
@Blauelf I used to enjoy TalesFromTechSupport but haven't checked it out in some time
@artoodeeto No, you need to use something like parseInt to accomplish it
Christopher McCormack
@cmccormack
Aug 25 2017 17:01
no need for the loop
Pieter Stokkink
@forkerino
Aug 25 2017 17:01
@cmccormack definitely get to know Redux, man. It forces you to write code in a way that decouples side effects from the logic, which is, in general, a good idea.
Christopher McCormack
@cmccormack
Aug 25 2017 17:01
ohh
sorry forgot it was multiple binary items
aRtoo
@artoodeeto
Aug 25 2017 17:02
@JLuboff then why did it say that we should use charCodeAt?
Pethaf
@Pethaf
Aug 25 2017 17:02
@Blauelf No.
Jason Luboff
@JLuboff
Aug 25 2017 17:02
@artoodeeto They give recomendations, not requirements
Pethaf
@Pethaf
Aug 25 2017 17:02
At the moment I'm involved in a pointless political discussion.
Pieter Stokkink
@forkerino
Aug 25 2017 17:02
@artoodeeto why would that be cheating?
aRtoo
@artoodeeto
Aug 25 2017 17:02
@cmccormack i think i need loop man. it has mult binary
Pieter Stokkink
@forkerino
Aug 25 2017 17:03
@Pethaf those can be fun, but also cost too much energy.
Christopher McCormack
@cmccormack
Aug 25 2017 17:03
@forkerino yeah, maybe I'll go back and update one of my projects to use it. My components aren't too deep right now so it doesn't bother me to pass them down a few times but it is still a bit cumbersome
aRtoo
@artoodeeto
Aug 25 2017 17:03
@forkerino i just thought. because it wasnt said we can use any other method
Christopher McCormack
@cmccormack
Aug 25 2017 17:03
@artoodeeto yeah I corrected myself, sorry
aRtoo
@artoodeeto
Aug 25 2017 17:03
@JLuboff aight. thanks man. mwaha
CamperBot
@camperbot
Aug 25 2017 17:03
artoodeeto sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2171 | @jluboff |http://www.freecodecamp.com/jluboff
aRtoo
@artoodeeto
Aug 25 2017 17:03
@cmccormack cool dude. thanks
Pieter Stokkink
@forkerino
Aug 25 2017 17:03
@artoodeeto yes, you can use anything you want
Pethaf
@Pethaf
Aug 25 2017 17:03
There is this guy who claims that the government is inefficent and wasteful in everything it does. And should stick to defence, infrastructure and upholding the law. I just had to ask him why we should trust the government with an army.
aRtoo
@artoodeeto
Aug 25 2017 17:04
@forkerino gotcha bro. thanks
CamperBot
@camperbot
Aug 25 2017 17:04
artoodeeto sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2926 | @forkerino |http://www.freecodecamp.com/forkerino
Pethaf
@Pethaf
Aug 25 2017 17:04
According to his own logic we would get a much better defense at a much lower cost by going the mercenary route.
It just ended with him insulting my ability to think.
silver537
@silver537
Aug 25 2017 17:05
Mercenary? Na that would cost more.
Pieter Stokkink
@forkerino
Aug 25 2017 17:05
@Pethaf ouch. Good luck with that one.
@artoodeeto maybe, as an exercise, you can try to use .map() to solve it?
instead of the loop
Pethaf
@Pethaf
Aug 25 2017 17:07
I wonder if a private army would even be able to front the logistics to have a navy or an airforce.
Most mercenary forces I know about seem to limit themselves to small groups with maybe some HMG/Rocket launcher support.
I.e. stuff that the group can carry on its own.
aRtoo
@artoodeeto
Aug 25 2017 17:11
@forkerino hmm. ill try.
Christopher McCormack
@cmccormack
Aug 25 2017 17:14
@forkerino I'm still working on building my own dev/prod setup - any advice? I just got source maps working, now looking for other neat tools similar to create-react-app
Jason Luboff
@JLuboff
Aug 25 2017 17:15
Ugh...I hate authentication sometimes..
Christopher McCormack
@cmccormack
Aug 25 2017 17:16
Yours or your users?
Jason Luboff
@JLuboff
Aug 25 2017 17:16
@cmccormack I'm revisiting (for the third? time) the Office 365 API. I need to authenticate without requiring user interaction..
Christopher McCormack
@cmccormack
Aug 25 2017 17:17
using SSO?
Jason Luboff
@JLuboff
Aug 25 2017 17:17
I created a digital sign for one of our conference rooms a while back, and currently have it setup were an individual has to go to a webpage to manually enter the calendar events, instead I'd like for it to auto populate
Pieter Stokkink
@forkerino
Aug 25 2017 17:17
@cmccormack what will be good is to set up a standard .editorconfig/.babelrc/.eslintrc, so that you get styling and transpilation out of the box. Another good thing is to set up some scripts in the package.json to run automatic tests/builds (including minification/uglification)/etc.
Jason Luboff
@JLuboff
Aug 25 2017 17:17
@cmccormack It uses Oauth
Christopher McCormack
@cmccormack
Aug 25 2017 17:19
@forkerino I can't seem to get eslint to clone well, I usually can copy the whole dir and just change some variables then run npm install but for some reason I always have to go through the eslint --init process to get it working
aRtoo
@artoodeeto
Aug 25 2017 17:19
@forkerino yow bro. your right. this is much shorter.
   return str.map(function(i){
    parseVal = parseInt(i,2);
    return (String.fromCharCode(parseVal));
  }).join('');
Christopher McCormack
@cmccormack
Aug 25 2017 17:19
then I literally copy the old .eslintrc.json file over the new one and it works fine... no idea why
Jason Luboff
@JLuboff
Aug 25 2017 17:20
@artoodeeto You don't even need parseVal = ... you can just have the paseInt inside the fromCharCode
Pieter Stokkink
@forkerino
Aug 25 2017 17:20
@artoodeeto :clap:
aRtoo
@artoodeeto
Aug 25 2017 17:20
@JLuboff yea. but just to make it clean.
Pieter Stokkink
@forkerino
Aug 25 2017 17:20
and as an aside, you can do the .split() also in the return
if you use arrow function it is quite easy to read if you don't use an intermediate parseVal variable
Christopher McCormack
@cmccormack
Aug 25 2017 17:21
@artoodeeto only cleaner if you're brand new to this, otherwise putting it in the method is just as good
it's only a few characters longer anyhow
Stephen James
@sjames1958gm
Aug 25 2017 17:21
as an aside you don't even need to split.
[].map.call(str, (c) => ());
Christopher McCormack
@cmccormack
Aug 25 2017 17:21
@sjames1958gm :wave:
aRtoo
@artoodeeto
Aug 25 2017 17:22
@cmccormack gotcha bro!
Stephen James
@sjames1958gm
Aug 25 2017 17:22
@cmccormack :wave:
Christopher McCormack
@cmccormack
Aug 25 2017 17:22
@artoodeeto my methodology is usually to create a variable that i MAY use more than once, and if I don't, just remove it and place the assignment directly where the variable is used
Pieter Stokkink
@forkerino
Aug 25 2017 17:23
@sjames1958gm woah, .map automatically splits a string at a space if you call it on a string?!?
Stephen James
@sjames1958gm
Aug 25 2017 17:23
@forkerino If you are doing single characters then array.map will process each character separately - like split on ''
Pieter Stokkink
@forkerino
Aug 25 2017 17:24
@sjames1958gm ok, but here the .split is on 'bytes' of length 8
/binary agents
Stephen James
@sjames1958gm
Aug 25 2017 17:24
Oops - I missed that part - shutting up now :(
Pieter Stokkink
@forkerino
Aug 25 2017 17:25
no worries
Christopher McCormack
@cmccormack
Aug 25 2017 17:25
hehe
Jason Luboff
@JLuboff
Aug 25 2017 17:26
The battle of the minds!
Christopher McCormack
@cmccormack
Aug 25 2017 17:27
> [].map.call('1001000 1111000'.split(' '), c=>String.fromCharCode(parseInt(c, 2)))
[ 'H', 'x' ]
> '1001000 1111000'.split(' ').map( c=>String.fromCharCode(parseInt(c, 2)) )
[ 'H', 'x' ]
No point to any of that, just thought I'd show @artoodeeto some options
aRtoo
@artoodeeto
Aug 25 2017 17:38
@cmccormack is this es6?
Christopher McCormack
@cmccormack
Aug 25 2017 17:38
@artoodeeto arrow notation is, yes
Eric
@Zaknefeinn
Aug 25 2017 17:39
var sessLength = parseInt($('.session').html());
$('.timer').html(sessLength + ":" + 00);
Why is this code showing up as 25:0 instead of 25:00?
Christopher McCormack
@cmccormack
Aug 25 2017 17:40
@Zaknefeinn + '00'
Eric
@Zaknefeinn
Aug 25 2017 17:40
I need to make it a string?
Christopher McCormack
@cmccormack
Aug 25 2017 17:41
yup, 00 will become 0 if you don't
> 00
0
Eric
@Zaknefeinn
Aug 25 2017 17:41
It's going to be a countdown timer. So I'll just have to reconvert it to a number immediately after wont I? Or is there another way?
Christopher McCormack
@cmccormack
Aug 25 2017 17:41
@Zaknefeinn easier to check if it's less than 10 and add a 0 only then
Eric
@Zaknefeinn
Aug 25 2017 17:42
I see... Thanks!
Christopher McCormack
@cmccormack
Aug 25 2017 17:42
np
codygreen88
@codygreen88
Aug 25 2017 18:24
what will happen if i call an isNaN function on "seventy-eight" and 78
Pethaf
@Pethaf
Aug 25 2017 18:25
Have you tried?
The nice thing with javascript is that you can try all kinds of crazy stuff and check what happens.
codygreen88
@codygreen88
Aug 25 2017 18:27
i tried and i got true for seventy eight and false for 78
Pieter Stokkink
@forkerino
Aug 25 2017 18:28
there you go
codygreen88
@codygreen88
Aug 25 2017 18:29
is that because seventy eight is a string and 78 is a number?
i appreciate the help
Eric
@Zaknefeinn
Aug 25 2017 18:34
NaN stands for not a number. So yes, that's correct. Seventy Eight is read "Seventy Eight"(a string) and 78 is a number, so isNaN(78) would return false.
codygreen88
@codygreen88
Aug 25 2017 18:35
cool thanks
Pagnito
@Pagnito
Aug 25 2017 18:36
hey im tryin to create an object constructor to and create an object instance for every recipe to push into local storage, but it keeps telling me my object constructor is not defined
Christopher McCormack
@cmccormack
Aug 25 2017 18:39
@Pagnito React?
Pagnito
@Pagnito
Aug 25 2017 18:39
yea
Christopher McCormack
@cmccormack
Aug 25 2017 18:39
What's your recipe component code look like?
Pagnito
@Pagnito
Aug 25 2017 18:40
right now im working inside of a modal, thats building the recipe, hold on
Christopher McCormack
@cmccormack
Aug 25 2017 18:40
You may need to clarify what you're trying to do as well, a bit confusing
Pagnito
@Pagnito
Aug 25 2017 18:41
import React from 'react'
import '../styles/modal.scss'
$(document).ready(function(){
    // the "href" attribute of the modal trigger must specify the modal ID that wants to be triggered
    $('.modal').modal();
  });
  var getElement = (query) => {
    return document.getElementById(query);
  }
class Modal extends React.Component {
  constructor(props){
    super(props)
    this.state = {
      ingridients: [],
      amounts: [],
      ingridient: '',
      amount: '',
      recipeName: ''
    }
    this.localStoreObj = this.localStoreObj.bind(this)
  }
  handleIngChange = (e) => {
    this.setState({ingridient:e.target.value})
    console.log(this.state.ingridient)
  }
  handleAmountChange = (e) => {
    this.setState({amount:e.target.value})
    console.log(this.state.amount)
  }
    addIng = ()=> {
      var newIng = this.state.ingridients.slice();
      newIng.push(this.state.ingridient)
      this.setState({ingridients: newIng})
      console.log(this.state.ingridients)

      $('#ingList').append(`<li>`+this.state.ingridient+`</li>`)

      var newAmounts = this.state.amounts.slice();
      newAmounts.push(this.state.amount)
      this.setState({amounts: newAmounts})
      console.log(this.state.amounts)
        $('#amountList').append(`<li>`+this.state.amount+`</li>`)
      this.setState({ingridient:''})
      this.setState({amount:''})


  }
   localStoreObj(recipeName,ingridients,amounts) {
     this.recipeName = recipeName;
     this.ingridients = ingridients;
     this.amounts = amounts;
  }
  localStoreArr = [];
  addRecipeToStorage =()=> {
    var recipe = new localStoreObj(this.state.recipeName,this.state.ingridients,this.state.amounts)
    localStoreArr.push(recipe)
    getElement('modalForm').reset()
    console.log(localStoreObj)
  }
  render(){
    return (
      <div>
        <div id="modal1" className="modal modal-fixed-footer">
        <form id="modalForm" >
          <div className="modal-content">
            <div className="input-field col">
            <input  id="recipeName" type="text" className="validate" />
            <label>Recipe Name</label>
          </div>
          <br/>
          <div className="row">
            <div className="input-field col s8 l6 m6 xl6">
               <input onChange={this.handleIngChange} value={this.state.ingridient} id="ingridient" type="text" className="validate" />
               <label>Ingridients</label>
             </div>
            <div className="input-field col s4 l2 m2 xl2 ">
                <input onChange={this.handleAmountChange} value={this.state.amount} id="amount" type="text" className="validate" />
                <label>Amount</label>
            </div>

            <div id="ingAddWrap" className="col s12 l2 m2 xl2">
             <a onClick={this.addIng}id="ingAdd"className="waves-effect waves-light btn-floating btn-medium modalBtn modal-trigger" href="#modal1"><i className="material-icons">add</i></a>
            </div>
          </div>
          <div className="row">
            <div className="col ingListWrap">
              <ul id="ingList"></ul>
            </div>
            <div className="col amountListWrap">
              <ul id="amountList"></ul>
            </div>
          </div>
          </div>
          <div className="modal-footer">
            <a onClick={this.addRecipeToStorage} href="#!" className="modal-action modal-close waves-effect waves-green btn-flat ">Add</a>
          </div>
          </form>
        </div>
        </div>
    )
  }
}
export default Modal
im tryin to store a recipe inside of an object instance and push it into local storage
i dnot really know how else to explain it
  localStoreObj(recipeName,ingridients,amounts) {
     this.recipeName = recipeName;
     this.ingridients = ingridients;
     this.amounts = amounts;
  }
its saying this is undefined
Joseph
@Big-jo
Aug 25 2017 18:43
localStorage.set('NewObjectName',JSON.stringify(ObjectName));
Pagnito
@Pagnito
Aug 25 2017 18:44
thats not the part im havin trouble with
im having trouble with creating the object before even pushing it into localstorage
Christopher McCormack
@cmccormack
Aug 25 2017 18:44
@Pagnito consider moving your localstorage function outside of your components
Pagnito
@Pagnito
Aug 25 2017 18:45
k hold on
Christopher McCormack
@cmccormack
Aug 25 2017 18:46
or just push a new object onto the array without trying to build a new one, not sure what benefit there is currently
Pagnito
@Pagnito
Aug 25 2017 18:47
k, it worked @cmccormack thanks
CamperBot
@camperbot
Aug 25 2017 18:47
pagnito sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1168 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
Aug 25 2017 18:47
np
Guderian Raborg
@hypercuber
Aug 25 2017 18:48
How do I use mousewheel? I just need to change one value.
window.addEventListener('mousewheel', function(event) {
  if (event.wheelDelta > 0) {
    console.log('positive');
  }
Christopher McCormack
@cmccormack
Aug 25 2017 18:49
@hypercuber that works, just make sure you close your tags
@hypercuber are you only attempting a single direction or any direction?
Guderian Raborg
@hypercuber
Aug 25 2017 18:54
@cmccormack I am trying to see if I can change a value by using mousewheel in three.js
Christopher McCormack
@cmccormack
Aug 25 2017 18:57
@hypercuber sure, but like I said your code above works so if you're having an issue maybe it's in what you're trying to capture - so what scrollwheel info are you trying to capture?
Guderian Raborg
@hypercuber
Aug 25 2017 18:59
@cmccormack idk
Christopher McCormack
@cmccormack
Aug 25 2017 19:00
@hypercuber Something like this maybe? https://codepen.io/cmccormack/pen/vJzLXP
Guderian Raborg
@hypercuber
Aug 25 2017 19:02
@cmccormack I suppose. The code doesnt change the value
codygreen88
@codygreen88
Aug 25 2017 19:05

im taking this practice exam and it doesnt tell me the answer after i get it wrong so im trying to double check the questions before i submit them do all four of these call divide demo and print 3? Which of following code snippets properly calculates the cost of 5 watermelons, which cost $8 each?

Snippet A:
function calculate(cost, 5, ){
return cost
5;
}
calculate(cost, 5);

Snippet B:
function calculate(cost, 5){
return cost 5;
}
calculate(5
8);

Snippet C:
function calculate(cost){
return cost * 5;
}
calculate(cost);

Snippet D:
function calculate(cost){
return cost * 5;
}
calculate(8);

var divideDemo = function (number, divisor) {
var val = number / divisor;
console.log(val);
};
Christopher McCormack
@cmccormack
Aug 25 2017 19:06
which do you think?
Also to format your code:
```
code
```
codygreen88
@codygreen88
Aug 25 2017 19:09

var divideDemo = function (number, divisor) {
var val = number / divisor;
console.log(val);
};

Which of the following statements will correctly call the function divideDemo and print 3?

A. function(6,2);

B. divideDemo = function(15,5);

C. (24,8);

D. divideDemo(12,4);

posted the wrong question this is the one i was stumped on have it for a, b and d
Gersho
@Gersho
Aug 25 2017 19:10
wow one at a time ^ ^
Christopher McCormack
@cmccormack
Aug 25 2017 19:10
@codygreen88 you can edit previous posts
@codygreen88 for the divide problem, which one do you think it is?
Gersho
@Gersho
Aug 25 2017 19:11
i kinda like the way those exercises are set up, where did you get them ?
codygreen88
@codygreen88
Aug 25 2017 19:11
code fellows
Gersho
@Gersho
Aug 25 2017 19:11
@codygreen88 thanks
CamperBot
@camperbot
Aug 25 2017 19:11
gersho sends brownie points to @codygreen88 :sparkles: :thumbsup: :sparkles:
:warning: @codygreen88's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
Gersho
@Gersho
Aug 25 2017 19:14
oh lol that's an actual school
codygreen88
@codygreen88
Aug 25 2017 20:51
yeah im trying to complete this entrance exam and am trying to get help on a couple questions
as some of the questions werent really touched on the practice material
codygreen88
@codygreen88
Aug 25 2017 21:09

Which of the following options will create an array that contains four elements?

Option A:
var list = ["a", "b", "c", "e"];

Option B:
var list = [];
list.push("a");
list.push("b");
list.push("c");
list.push("e");

Option C:
var list = ["a"];
list.push("b");
list.push("c");
list.push("e");

Option D:
var list = new Array();
list.add("a");
list.add("b");
list.add("c");
i got a,b,and c

Gersho
@Gersho
Aug 25 2017 21:13
that seems about right
codygreen88
@codygreen88
Aug 25 2017 21:14
thanks bud
mind if i bounce two others off you @Gersho ?
codygreen88
@codygreen88
Aug 25 2017 21:20

code var divideDemo = function (number, divisor) {
var val = number / divisor;
console.log(val);
};

Which of the following statements will correctly call the function divideDemo and print 3?

A. function(6,2);

B. divideDemo = function(15,5);

C. (24,8);

D. divideDemo(12,4); code is it all of the above?

Jason Luboff
@JLuboff
Aug 25 2017 21:20
D
D is the only one that actually calls the function
codygreen88
@codygreen88
Aug 25 2017 21:21
ok cuz its calling that function with a number of 12 and a divisor of 4. thanks @JLuboff @Gersho
CamperBot
@camperbot
Aug 25 2017 21:21
codygreen88 sends brownie points to @jluboff and @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 361 | @gersho |http://www.freecodecamp.com/gersho
:star2: 2172 | @jluboff |http://www.freecodecamp.com/jluboff
Eric
@Zaknefeinn
Aug 25 2017 21:23
I'm doing the Pomodoro Clock project. I'm struggling to get the break timer to jump back to session timer after it's ran. Would anyone mind giving me a hand?
aRtoo
@artoodeeto
Aug 25 2017 22:35
yow fam. how can i return one single value? so on the everything be true algo challenge i need to loop thru the collection and check the keys if it has a true value. if not return false. but its returning me multiple bool. heres the code fam. thanks

function truthCheck(collection, pre) {

return  collection.map(function(collection){

      if(collection[pre]){
        return true;
      }else {
        return false;
      }    
  });

}
Moisés Man
@moigithub
Aug 25 2017 22:47
if collection array have 5 elements.. map also return 5 elements array
charles
@code9ja
Aug 25 2017 22:56
Hi I am having challenges with my challenge 196
I have this code

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

if (val > 10) { // Change this line
return " over 100";
}

return "10 or Under";
}

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

Jason Luboff
@JLuboff
Aug 25 2017 22:57
@code9ja Well if val > 10 thats not over 100 :D
And you need to make sure your string match exactly what FCC has
charles
@code9ja
Aug 25 2017 22:58
What am I doing wrong
Jason Luboff
@JLuboff
Aug 25 2017 22:58
@code9ja Read your code out loud
charles
@code9ja
Aug 25 2017 22:58
@JLuboff LOL
@JLuboff let me see it again
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:01
@JLuboff Hey man :wave:
Jason Luboff
@JLuboff
Aug 25 2017 23:01
Yo
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:02
@JLuboff how're you doing?
Jason Luboff
@JLuboff
Aug 25 2017 23:02
Not too bad, almost time to go home..you?
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:03
was about asking if you're still at work
Jason Luboff
@JLuboff
Aug 25 2017 23:03
Ya another hour
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:03
wow.... I am in the future remember?
Jason Luboff
@JLuboff
Aug 25 2017 23:03
:D
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:04
it's night here so it will be night over there soon
so prepare for it, okay?
Jason Luboff
@JLuboff
Aug 25 2017 23:04
I'll do my best :P
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:05
:smile:
charles
@code9ja
Aug 25 2017 23:05

@JLuboff I changed it to this ```function testGreaterThan(val) {
if (val > 100) { // Change this line
return "Over 100";
}

if (val > 10) { // Change this line
return " over 10";
}

return "10 or Under";
}

// Change this value to test
testGreaterThan(101);```

and I am still getting over 100, but not over 10
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:06
@code9ja how would you know if val is greater than 10?
Jason Luboff
@JLuboff
Aug 25 2017 23:06
@code9ja Ok great, thats looking better, However.. check your return strings, it needs to match what FCC has
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:06
@code9ja you need to arrange the logic of your code
@code9ja a value greater than 100 is greater than 10
charles
@code9ja
Aug 25 2017 23:08
yes I thought of that
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:08
@code9ja but I think it's okay too
don't mind me
charles
@code9ja
Aug 25 2017 23:09
@Lumexralph this instruction does not work - testGreaterThan(11) should return "Over 10"
I return "over 100"
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:10
@code9ja check your string
Jason Luboff
@JLuboff
Aug 25 2017 23:10
@code9ja "Over 10" does not equal what you have " over 10"
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:10
@code9ja check the cases
Kelechi Chinaka
@ke1echi
Aug 25 2017 23:11
:wave:
charles
@code9ja
Aug 25 2017 23:13
@Lumexralph @JLuboff please give me a second to recheck my logic
Brb
Ogundele Olumide
@Lumexralph
Aug 25 2017 23:14
@code9ja take your time bro, make sure the requested string or value is what your function is giving
@kelechy Brotherly
Kelechi Chinaka
@ke1echi
Aug 25 2017 23:15
the answer is staring at you @code9ja
u up this late @Lumexralph