These are chat archives for FreeCodeCamp/HelpJavaScript

17th
Jan 2018
Jason Luboff
@JLuboff
Jan 17 2018 00:00
@briandudey Looks ok to me. Try refreshing the page
Brian Dudey
@briandudey
Jan 17 2018 00:02
hmmmm. No luck with refresh. Thanks for the extra eyes.
Henry
@GitHub-Henry
Jan 17 2018 00:03
must be a bug with the test
Brian Dudey
@briandudey
Jan 17 2018 00:04
I thought it was right. I get the error: "You should use two double quotes (") and four escaped double quotes (\")."
Henry
@GitHub-Henry
Jan 17 2018 00:05
you might want to code with something like codepen cuz it's a nice editor and paste your results in the test area
Brian Dudey
@briandudey
Jan 17 2018 00:05
Thanks, Henry. I'll try that.
Jason Luboff
@JLuboff
Jan 17 2018 00:07
@briandudey Try reseting the code or try in a different browser
Ayush Bahuguna
@relentless-coder
Jan 17 2018 02:35
React Newbie here, help!!
abraham anak agung
@padunk
Jan 17 2018 02:49
@relentless-coder how can we help?
Ayush Bahuguna
@relentless-coder
Jan 17 2018 03:01
@padunk wait, first let me build my react. I wrote code, but didn't build it.
jusgoose
@gusd773
Jan 17 2018 04:07
mutations challenge
jusgoose
@gusd773
Jan 17 2018 04:16

help mutations challenge need help not sure what I'm not seeing to cover tests 3-7 on the green checks column on the left

function mutation(arr) {
var testA = arr[0].toLowerCase().indexOf(arr[0].toLowerCase());
var testB = arr[1].toLowerCase().indexOf(arr[0].toLowerCase());

return testA==testB;
}

mutation(["Mary", "Army"]);

Markus Kiili
@Masd925
Jan 17 2018 06:31
@gusd773 You need to loop or iterate the second string characters and test if they are found on the first string.
jusgoose
@gusd773
Jan 17 2018 07:19
@Masd925 thanks i'll try that rn
CamperBot
@camperbot
Jan 17 2018 07:19
gusd773 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4656 | @masd925 |http://www.freecodecamp.org/masd925
Happy-Ferret
@Happy-Ferret
Jan 17 2018 08:42

@Blauelf For now I've just settled with making the whole extension async across the board (probably not the worst idea anyhow. It's just curiosity that makes me want to try something different).

Here's code that actually works. And yes. await just returns a promise. It's so much nicer than the "old way" though.

class CookieButton {

    async getStorageAsync() {
      var storage = await browser.storage.local.get();
      return storage;
    }

    get ButtonState() {
      console.log("GET");
      return this.getStorageAsync().then(x => x.buttonState);
    }

    set ButtonState(value) {
      console.log("SET");
      return browser.storage.local.set({ buttonState: value });
    }

    constructor() {
      this.testAsync();
    }

    async testAsync() {
      // Test setter
      this.ButtonState = 'turn-off';
      // Test getter
      console.log(await this.ButtonState);
   }
}
Unwana Essien
@afixoftrix
Jan 17 2018 10:30
hello, has anyone done the learnyoumongo challenge/ lesson??
Praveen Kumar Saini
@praveen-me
Jan 17 2018 10:43
what we use 'this' keyword?
what is it's main purpose?
Markus Kiili
@Masd925
Jan 17 2018 10:46
@Praveen-coding Are you referring to the code above, or asking generally about this in JS?
Praveen Kumar Saini
@praveen-me
Jan 17 2018 10:46
yup...
tell me how this this keyword works?
Markus Kiili
@Masd925
Jan 17 2018 10:48
@Praveen-coding It is a special keyword and its value depends on how the function was called https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this
When a function call is made and an execution context formed, it has these special variables like arguments and this.
Praveen Kumar Saini
@praveen-me
Jan 17 2018 10:51
@Masd925, if i want to call a global a variable inside my function, so in that case,
can i use this keyword...
Markus Kiili
@Masd925
Jan 17 2018 10:53
@Praveen-coding If this points to the window, you can use it to access global variables, but using window is clearer.
Praveen Kumar Saini
@praveen-me
Jan 17 2018 10:54
@Masd925 but when it refers to document.
Markus Kiili
@Masd925
Jan 17 2018 10:56
@Praveen-coding It doesn't usually refer to document, but you can manually set it to refer to any object.
Christopher
@bradley1492
Jan 17 2018 12:47

Good afternoon,

I am in the https://www.freecodecamp.org/challenges/exact-change

I just tried to sum up all the numbers of the currencies in the cash register, but my console logged out a funny periodic number.

I added [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);together, but it didn't log out 335,41as it should, but instead 335.40999999999997.

What is happening here?

Fabien SHAN
@X140hu4
Jan 17 2018 12:47
float. Computers cannot represent decimals exactly
Christopher
@bradley1492
Jan 17 2018 12:48
Does it sort of automatically make mistakes as soon as I work with decimals?
Markus Kiili
@Masd925
Jan 17 2018 12:48
@bradley1492 The robust way is to use penny amounts that are safe integers.
Christopher
@bradley1492
Jan 17 2018 12:49
@Masd925 Safe Integers? I think I have to research on the whole float thing :)
Marianissimus
@Marianissimus
Jan 17 2018 12:50
@bradley1492 basically, convert your coins to cents and do your math... yeah, it sucks, but there is no way around it
Markus Kiili
@Masd925
Jan 17 2018 12:50
@bradley1492 In JS, there is only one Number type that are 64bit floats. Only integers smaller than Number.MAX_SAFE_INTEGER; // 9007199254740991 are guaranteed to have an exact representation as floats. So most numbers are a bit off.
Christopher
@bradley1492
Jan 17 2018 12:51

@Masd925 thanks

It's quite a funny feeling to think that the computer is more stupid than me

CamperBot
@camperbot
Jan 17 2018 12:51
bradley1492 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4658 | @masd925 |http://www.freecodecamp.org/masd925
Christopher
@bradley1492
Jan 17 2018 12:53
@Marianissimus Ah ok so I would represent everything with like a dollar is 100, fifty cents are 50 etc... ?
Markus Kiili
@Masd925
Jan 17 2018 12:53
@bradley1492 If you turn all money abounts into pennies, you can compare them without rounding problems.
Christopher
@bradley1492
Jan 17 2018 12:54
@Masd925 Alright I'll do that
But arent't my numbers way smaller than 9007199254740991?
Hence should be represented accurately?
Ayush Bahuguna
@relentless-coder
Jan 17 2018 12:55

can anyone help me with react?
this is my component

export function AllExpense(props) {
    const renderExpense = ({data}) => {
        console.log(data.data);
        return (
            <div>
                <div>
                    <h2><Link to="/expense/new">Add Expense</Link></h2>
                </div>
                {
                    data.data.length > 0 ? <ul>
                        <li>
                            data.data.map(el =><ListItem key={el._id.toString()} value={el}/>)
                        </li>
                    </ul> : <h2>Enter some data!!</h2>
                }

            </div>
        )
    };
    return allExpenseAPi().then(renderExpense).catch((err) => {
        alert(err.message)
    })
}

and I keep getting error Objects are not valid as a React child

Markus Kiili
@Masd925
Jan 17 2018 12:55
@bradley1492 Yes. That means that they have an exact representation as floats.
Christopher
@bradley1492
Jan 17 2018 12:56
@Masd925 Okay, I'll just read up a bit on it
Markus Kiili
@Masd925
Jan 17 2018 12:56
@bradley1492 If you use decimal numbers, they almost always are not accurate.
Christopher
@bradley1492
Jan 17 2018 12:57
@Masd925 So nobody uses them in programming?
Markus Kiili
@Masd925
Jan 17 2018 12:58
@bradley1492 All languages have floats, but most languages also have other number types that suit different situations better, like holding money amounts. You would use some library in JS for banking applications.
Christopher
@bradley1492
Jan 17 2018 12:59
@Masd925 Ah alright thanks :)
CamperBot
@camperbot
Jan 17 2018 12:59
bradley1492 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
api offline
Ayush Bahuguna
@relentless-coder
Jan 17 2018 13:04
okay, I resolved it, nevermind
Blauelf
@Blauelf
Jan 17 2018 13:17
@Masd925 Number.MAX_SAFE_INTEGER is the largest integer that you can safely add one to. So your description with "Only integers smaller than" is off by two.
Markus Kiili
@Masd925
Jan 17 2018 13:20
@Blauelf Yes, thanks.
CamperBot
@camperbot
Jan 17 2018 13:20
masd925 sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4674 | @blauelf |http://www.freecodecamp.org/blauelf
Blauelf
@Blauelf
Jan 17 2018 13:21
@bradley1492 I converted all the values from dollars as base unit to cents (multiplying by 100 and rounding). That's called fixed point (as opposed to floating point), you essentially use an integer and keep in mind that its value is to be multiplied by a certain constant for presentation. There also are standards for base10 floating point (interpreting the exponent not as a power of 2 but 10), but that's harder to handle in the processor, as multiplication/division by 2 is a simple bit shift, while 10 (that's ten, not binary two) isn't.
@Masd925 Not that we are close to that number at all (so the difference won't matter) :P
@Masd925 All those people waiting for their for (var i = Number.MAX_SAFE_INTEGER + 1; i < Number.MAX_SAFE_INTEGER + 2; i++); to terminate, that's clearly just one iteration :D
Blauelf
@Blauelf
Jan 17 2018 13:37
Oh. Number.MAX_SAFE_INTEGER+1===Number.MAX_SAFE_INTEGER+2. Should have written Number.MAX_SAFE_INTEGER+3 then.
Markus Kiili
@Masd925
Jan 17 2018 13:43
@Blauelf Touche ;)
Ogechi Ike
@BlackMG27
Jan 17 2018 15:53
hello, I am having some trouble with the stand in line problem. I got the first part, but I'm still have an error. Thank you in advance.
function nextInLine(arr, item) {
  // Your code here
  //add the last number
  arr = arr.push(item); 
  //remove the first number
  arr = arr.shift();
  return arr;  // Change this line
}
Kaz Baig
@kbaig
Jan 17 2018 15:57
@BlackMG27 could you share the link to the prob
Kaz Baig
@kbaig
Jan 17 2018 15:59
That doesn't look right
this is a boolean problem
ah looks like it's the problem right before this one
Kaz Baig
@kbaig
Jan 17 2018 16:01
@BlackMG27 take a look at the documentation for Array.push and Array.shift
They don't return the array, they return something else
So by assigning arr whatever is returned by calling arr.push or arr.shift, you're not assigning arr the new array
You don't need to do assignments for these two array methods in order to modify them
var arr = [1, 2, 3];
arr.push(4);

console.log(arr); // [1, 2, 3, 4]
This phenomenon, wherein assigned values are changing without reassigning variables, is called mutation
Ogechi Ike
@BlackMG27
Jan 17 2018 16:13
@kbaig thanks! I kept putting the arr= on the wrong line.
CamperBot
@camperbot
Jan 17 2018 16:13
blackmg27 sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 532 | @kbaig |http://www.freecodecamp.org/kbaig
dinesh
@1532j0004kg
Jan 17 2018 17:18
i need help.
Josh
@JoshrlNZ
Jan 17 2018 17:18
What do you need help with?
dinesh
@1532j0004kg
Jan 17 2018 17:19
router.put('/update/:id' , function(req , res){
  var id = req.params.id;
  myModel.findOne({_id : id } , function (err , foundObjects){
  //  console.log(foundObjects);
   foundObjects.name = req.body.name;
    //  console.log(foundObjects.name);
       foundObjects.profession = req.body.profession;
       foundObjects.save(function(err , updatedObject){
                    res.send(updatedObject);

    });
});
});
in this when i trying to update the record in table its not working properly .
This message was deleted
when itried to console the foundObject.name and foundObjects.profession
but when i consoling the foundObjects it shows the object correctly .
this is my problem .
Christopher McCormack
@cmccormack
Jan 17 2018 17:26
@1532j0004kg waiting for the error message
Jason Luboff
@JLuboff
Jan 17 2018 17:26
@cmccormack So pushy
Christopher McCormack
@cmccormack
Jan 17 2018 17:26
@1532j0004kg are you getting an error message, is the db not updating, ...
@JLuboff :D
Daniel Romero
@Ranacode
Jan 17 2018 17:26

Is this normal?
//TYPESCRYPT

function test(person) {
  if (2 < 3) {
    let test = "test";
  }

  return "Hello, " + person;
}
//JAVASCRIPT
function test(person) {
    if (2 < 3) {
        var test_1 = "test";
    }
    return "Hello, " + person;
}
console.log(test("Ariadna"));

I mean, the typescript compiler doesn't apply babel by default?

I write this because the let variable transform into var
dinesh
@1532j0004kg
Jan 17 2018 17:27
@cmccormack its not actual error when i try to update the table its not working .
when itried to console the foundObjects.name and foundObjects.profession those are tells that undefined
but when i consoling the foundObjects it shows the object correctly .
can u able to get my problem , hope u can :smile:
Christopher McCormack
@cmccormack
Jan 17 2018 17:29
@1532j0004kg did you log your err to see if there is an error?
dinesh
@1532j0004kg
Jan 17 2018 17:30
where i want log the error , i logged the foundObjects.name , it outputs that undefined
Jason Luboff
@JLuboff
Jan 17 2018 17:31
       foundObjects.save(function(err , updatedObject){
if(err) console.log(err);
                    res.send(updatedObject);
dinesh
@1532j0004kg
Jan 17 2018 17:31
foundObjects.name itself not working .
but updation is working without updating the field .
Jason Luboff
@JLuboff
Jan 17 2018 17:33
if foundObjects.name is returning undefined then there is no property of that name or no value to it
dinesh
@1532j0004kg
Jan 17 2018 17:34
but the foundObjects returning the object with property name and profession
{ _id: 5a5f80cbc515500594f823b4,
  profession: 'dinesh',
  name: 'scs',
  __v: 0 }
when i logged the foundObjects.nameundefined
Jason Luboff
@JLuboff
Jan 17 2018 17:36
Then req.body.name is undefined
dinesh
@1532j0004kg
Jan 17 2018 17:36
may be , the how ?
i given the "profession" :"value" and "name" : "value" in postman
Christopher McCormack
@cmccormack
Jan 17 2018 17:37
does put work like post, storing the form data in the body property?
@1532j0004kg you have body parsing middleware?
dinesh
@1532j0004kg
Jan 17 2018 17:38
yes, then only post is worked
Jason Luboff
@JLuboff
Jan 17 2018 17:39
@cmccormack PUT and POST are very similar, and can be used pretty much interchangeable from my understanding
Ankur sharma
@ankur1163
Jan 17 2018 17:39
can someone tell me
whats the design /schema for large scale rest api
any tut, video article?
lets say i want to build project management with crm, HR , chat
I am confused how should rest api looks. Like what should be differnt endpoints
which one i should group together
any tut on this?
dinesh
@1532j0004kg
Jan 17 2018 17:40
@ankur1163 do u want to learn mongo?
Ankur sharma
@ankur1163
Jan 17 2018 17:42
I already know mongo
I can design basic schema as well
but, how do large apps like asana, facebook
design their schema
just theoretical prespective
dinesh
@1532j0004kg
Jan 17 2018 17:42
i just learning .
sry , probably someone can help u!
Henry
@GitHub-Henry
Jan 17 2018 17:43
mongo university has courses
dinesh
@1532j0004kg
Jan 17 2018 17:43
@ankur1163 then can u able to rectify my err ?
Ankur sharma
@ankur1163
Jan 17 2018 17:44
ok thanks @GitHub-Henry
CamperBot
@camperbot
Jan 17 2018 17:44
ankur1163 sends brownie points to @github-henry :sparkles: :thumbsup: :sparkles:
:cookie: 530 | @github-henry |http://www.freecodecamp.org/github-henry
Ankur sharma
@ankur1163
Jan 17 2018 17:44
thanks @1532j0004kg
CamperBot
@camperbot
Jan 17 2018 17:44
ankur1163 sends brownie points to @1532j0004kg :sparkles: :thumbsup: :sparkles:
:cookie: 265 | @1532j0004kg |http://www.freecodecamp.org/1532j0004kg
Jason Luboff
@JLuboff
Jan 17 2018 17:45
Eh...I don't know how good Mongo would be for such a large database like Facebook. I'd think a relational database would be much better suited (And faster) but I also don't have experience building anything of that scale
Ankur sharma
@ankur1163
Jan 17 2018 17:47
@JLuboff
ebay use them
expedia as well
Jason Luboff
@JLuboff
Jan 17 2018 17:50
But not solely
eBay: Delivering all media metadata at 99.999% availability.
Expedia: simplifies travel shopping for millions of customers with their Scratchpad app
They're using it for components of their website/apps but not the full thing
At least, thats how I'm interpeting that
Ankur sharma
@ankur1163
Jan 17 2018 17:52
could be
@JLuboff
Jason Luboff
@JLuboff
Jan 17 2018 17:58
@cmccormack whats your opinion on the matter
Christopher McCormack
@cmccormack
Jan 17 2018 17:58
@JLuboff I think you will never know the tool you need until you know what your needs are
I think none of us are giant companies so using Mongo is just fine :)
dinesh
@1532j0004kg
Jan 17 2018 18:02
can u pls tell what will be the error in req.body.name
Ankur sharma
@ankur1163
Jan 17 2018 18:04
@JLuboff @cmccormack I have learned coding is a rabbit hole
Jason Luboff
@JLuboff
Jan 17 2018 18:04
@1532j0004kg Have you tired console.log(req.body.name???
Ankur sharma
@ankur1163
Jan 17 2018 18:04
just pick something and run with it
:)
Christopher McCormack
@cmccormack
Jan 17 2018 18:04
@ankur1163 it's a learning hole :)
Ankur sharma
@ankur1163
Jan 17 2018 18:04
if you for a second , stop and start thinking which one is best
Christopher McCormack
@cmccormack
Jan 17 2018 18:04
@1532j0004kg @JLuboff yeah log everything and you will find your issues
Ankur sharma
@ankur1163
Jan 17 2018 18:04
than, world will paralyze you
@1532j0004kg post the code, i will take a look
I am working with loopback.js
Jason Luboff
@JLuboff
Jan 17 2018 18:05
console.log is a god send. I wish there was such a thing in C# when using windows forms. Instead oyu have to use breakpoints which can be a pain :(
Ankur sharma
@ankur1163
Jan 17 2018 18:05
can create full fledged api in hours
which might take months
Christopher McCormack
@cmccormack
Jan 17 2018 18:05
@JLuboff debug tools can be hella useful, but only if you spend the time learning how to use them
(which I never do)
dinesh
@1532j0004kg
Jan 17 2018 18:05
i tried it says undefined
Jason Luboff
@JLuboff
Jan 17 2018 18:05
@1532j0004kg Ok then there's your issue..
dinesh
@1532j0004kg
Jan 17 2018 18:05
router.put('/update/:id' , function(req , res){
  var id = req.params.id;
  myModel.findOne({_id : id } , function (err , foundObjects){
    console.log(foundObjects);
    console.log(req.body.name);
    if(req.body.name)
  {
         foundObjects.name = req.body.name;
  }
else {
  res.send("err");
}
    //  console.log(foundObjects.name);
    if(req.body.profession)
    {
       foundObjects.profession = req.body.profession;
   }
       else {
         res.send("err");
       }
       foundObjects.save(function(err , updatedObject){
                    res.send(updatedObject);

    });
});
});
@ankur1163
Christopher McCormack
@cmccormack
Jan 17 2018 18:06
@1532j0004kg what does your form look like?
Jason Luboff
@JLuboff
Jan 17 2018 18:06
@cmccormack Don't get me wrong, breakpoints are a good debugging tool but inefficient imo
dinesh
@1532j0004kg
Jan 17 2018 18:06
@cmccormack schema u asking?>
Christopher McCormack
@cmccormack
Jan 17 2018 18:06
@1532j0004kg no actual html form
dinesh
@1532j0004kg
Jan 17 2018 18:07
am trying with postman , no html code i have
Jason Luboff
@JLuboff
Jan 17 2018 18:07
@cmccormack Btw...passed my third MTA test yesterday so now onto MCSA SQL 2016
Christopher McCormack
@cmccormack
Jan 17 2018 18:08
@JLuboff congratulations!
Jason Luboff
@JLuboff
Jan 17 2018 18:08
@1532j0004kg ...are you including the form data from postman? If not..how would req.body.name be populated?
@cmccormack Thanks!
CamperBot
@camperbot
Jan 17 2018 18:08
jluboff sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1294 | @cmccormack |http://www.freecodecamp.org/cmccormack
dinesh
@1532j0004kg
Jan 17 2018 18:10
no i am just trying to update on the existing data (i had already) and i am going to view those updates in postman or database /
Jason Luboff
@JLuboff
Jan 17 2018 18:10
Ok..so thats why name is undefined...you're changing it to undefined..
dinesh
@1532j0004kg
Jan 17 2018 18:11
then how to make as working copy .
Jason Luboff
@JLuboff
Jan 17 2018 18:12
Either assign an acutal value to name instead of req.body.name or in postman include req.body.name (its been a while since I'm used postman so I don't recall how)
dinesh
@1532j0004kg
Jan 17 2018 18:13
no but i seen in the video their giving the value like in my code.
Christopher McCormack
@cmccormack
Jan 17 2018 18:16
@1532j0004kg log the req.body object and see if you're getting anything - if not, then you need to figure out why the body is not being sent along with the request
dinesh
@1532j0004kg
Jan 17 2018 18:17
thanks @all who helps me , its now working
CamperBot
@camperbot
Jan 17 2018 18:17
1532j0004kg sends brownie points to @all :sparkles: :thumbsup: :sparkles:
api offline
dinesh
@1532j0004kg
Jan 17 2018 18:17
the actual problem is missed the header in postman
:smile:
Christopher McCormack
@cmccormack
Jan 17 2018 18:18
@1532j0004kg :thumbsup:
dinesh
@1532j0004kg
Jan 17 2018 18:19
can u pls say what is the use of application/json
This message was deleted
Christopher McCormack
@cmccormack
Jan 17 2018 18:39
@1532j0004kg if you want to send an object to the backend you can use application/json. I believe the default when posting using a form is urlencoded where the fields get parsed as part of the URL.
dinesh
@1532j0004kg
Jan 17 2018 18:40
ok
thanks @cmccormack
CamperBot
@camperbot
Jan 17 2018 18:40
1532j0004kg sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1295 | @cmccormack |http://www.freecodecamp.org/cmccormack
dinesh
@1532j0004kg
Jan 17 2018 18:40
and happie night
:smile:
Christopher McCormack
@cmccormack
Jan 17 2018 18:40
@1532j0004kg good night!
Kaz Baig
@kbaig
Jan 17 2018 18:41
@cmccormack your ssl cert is expired fyi. Just wanted to make sure you know :)
Christopher McCormack
@cmccormack
Jan 17 2018 18:41
dangit, I just checked that a few days ago too :) thanks @kbaig
CamperBot
@camperbot
Jan 17 2018 18:41
cmccormack sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 534 | @kbaig |http://www.freecodecamp.org/kbaig
Kaz Baig
@kbaig
Jan 17 2018 18:42
Haha no prob
Christopher McCormack
@cmccormack
Jan 17 2018 18:42
I need to get off godaddy hosting so I can autorenew
Kaz Baig
@kbaig
Jan 17 2018 18:43
godaddy :-1:
Christopher McCormack
@cmccormack
Jan 17 2018 18:45
I know I know but they had a really good deal going on when I signed up
Kaz Baig
@kbaig
Jan 17 2018 18:47
Hostgator :-1: :-1:
Because I know about godaddy's reputation, but I've been screwed over by hostgator
I cancelled hosting and they still charged me ~120 bucks for hosting addons a month later. They acted like it would be a big favor on their part to refund it
Jason Luboff
@JLuboff
Jan 17 2018 18:50
You can't beat < $2 domains from godaddy though lol
Kaz Baig
@kbaig
Jan 17 2018 18:52
Yeah if you actually snag them in the same session as you searched
otherwise they'll buy it and charge you more
Christopher McCormack
@cmccormack
Jan 17 2018 18:53
@JLuboff I'm currently only paying $1 a month
I bought my domain through hover
Kaz Baig
@kbaig
Jan 17 2018 18:54
I'd rather pay a few bucks more so that my business is going to a more ethical company, but I also understand money is money
:clap: judge free zone :clap:
Christopher McCormack
@cmccormack
Jan 17 2018 19:01
Know any cheap VPC hosting services?
Jason Luboff
@JLuboff
Jan 17 2018 19:12
Eh I gave up my domain after the first year since I didn't feel like paying $15/year. Plus I was only using it for my VPN which I don't have setup any longer
Kaz Baig
@kbaig
Jan 17 2018 19:14
I'll continue paying for my domain when I finally rebuild my site
It'll be a minute tho
Jason Luboff
@JLuboff
Jan 17 2018 19:20
Hmmm...should I upgrade my VS community to 2017 or stay at 2015
Adam Bohannon
@abohannon
Jan 17 2018 19:29
@kbaig do you pay for your own server?
Christopher McCormack
@cmccormack
Jan 17 2018 19:35
the price for a domain and a server is the price of like 4 coffees a year, and having something out there as a portfolio on a server can't be a bad thing
Jason Luboff
@JLuboff
Jan 17 2018 19:35
@cmccormack ...but I don't drink coffee...so thats just money out of my pocket!
Christopher McCormack
@cmccormack
Jan 17 2018 19:36
something something spend money to make money
Jason Luboff
@JLuboff
Jan 17 2018 19:37
I've spent money of Bitcoin...haven't seen a return yet. I'm not very good at it :joy:
Christopher McCormack
@cmccormack
Jan 17 2018 19:38
bitcoin isn't value investing though, but you are!
Jason Luboff
@JLuboff
Jan 17 2018 19:38
Touche
Christopher McCormack
@cmccormack
Jan 17 2018 19:38
I'd invest in you if the return % was decent :)
Jason Luboff
@JLuboff
Jan 17 2018 19:39
Well.. I did earn a 7.2% raise yesterday...so I'd say thats decent
Christopher McCormack
@cmccormack
Jan 17 2018 19:40
I knew I should have invested in @JLuboff before it skyrocketed!!!
Kaz Baig
@kbaig
Jan 17 2018 19:40
@abohannon I'm not paying for hosting atm
Jason Luboff
@JLuboff
Jan 17 2018 19:41
@cmccormack ;)
Now to hussle and get my SQL MCSA...then I'll get another 12.5% raise..but..I suspect thats going to take me the whole year to do
Christopher McCormack
@cmccormack
Jan 17 2018 19:43
@JLuboff gl man, keep at it
Jason Luboff
@JLuboff
Jan 17 2018 19:43
Thats the plan, can't stop won't stop am i right?
Christopher McCormack
@cmccormack
Jan 17 2018 19:45
@JLuboff yes?
Jason Luboff
@JLuboff
Jan 17 2018 19:45
Damn right!
Christopher McCormack
@cmccormack
Jan 17 2018 19:45
haha I thought the same way, then I took a few weeks off in Maui and can't seem to find my stride
I also got a Switch and BotW which is pretty dang fun and distracting
Jason Luboff
@JLuboff
Jan 17 2018 19:46
Oh I'm sure once I start studying I'm going to be discouraged lol. From the little bit I read, the test is very intense
BotW?
Christopher McCormack
@cmccormack
Jan 17 2018 19:46
Zelda game
Jason Luboff
@JLuboff
Jan 17 2018 19:46
Ooooh gotcha gotcha
Lunch time. See ya in a bit
Christopher McCormack
@cmccormack
Jan 17 2018 19:48
later man
MaciejReimann
@MaciejReimann
Jan 17 2018 21:01

currentArray: function() {
let currentArray = [];
return {
get: function() { return currentArray },
set: function(n) { currentArray = n },
};
}

Hi! Given above snippet of code, if I do currentArray().set( anArray ), the currentArray variable inside the function won't be changed. Why?

Diego Mayer
@Chrono79
Jan 17 2018 21:20
I think you missed this. there
MaciejReimann
@MaciejReimann
Jan 17 2018 21:24
@Chrono79 - thank you, but my question was 'why?'. I know I can make it work using the constructor pattern, but it doesn make me understand JS better.
CamperBot
@camperbot
Jan 17 2018 21:24
maciejreimann sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4605 | @chrono79 |http://www.freecodecamp.org/chrono79
Mois├ęs Man
@moigithub
Jan 17 2018 21:25
no this needed.. cuz by scope.. it can access parent variable
plus he not using "new" keyword
if u chain currentArray().set( anArray ) set call directly on the functoin .. u not saving the object returned by that function.. so it get lost (loose the object reference)
soo if u try to do currentArray().get() <- it will try to use another object, the "correct" way should be using variables.. like that pen.. (but no this needed if u not using "new"/constructor )
and.. ofc i been away for 2 months, lost practice.. so i might be wrong :P
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:30
Hello guys, hows been your day?
I'm here again. Of course I need help
I'm halfway through the wikipedia challenge but I've hit a snag. My previous search stacks alongside the current search. the previous search was supposed to clear off but it's not. https://codepen.io/hoxtygen/pen/eyVaoV
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:37
I need a direction pls
Ogechi Ike
@BlackMG27
Jan 17 2018 21:39
@Hoxtygen I had a similar problem. inside your main function, you will need to make a smaller function that removes the appended results.
Christopher McCormack
@cmccormack
Jan 17 2018 21:39
@Hoxtygen clear your output container - document.getElementById('output').innerHTML = ''
something like that
@Hoxtygen also I would recommend using the form submit event for your listener so the button click as well as hitting Enter will submit the request
Ogechi Ike
@BlackMG27
Jan 17 2018 21:40
@Hoxtygen here's what mines looks like:
function reset(){
    //grab what I want to reset/ clear
    //clear the field 
        var childRemove = $('.results').remove();
    return childRemove;
  }
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:47
@BlackMG27 @cmccormack will the clearing function be placed outside or inside the main function?
Christopher McCormack
@cmccormack
Jan 17 2018 21:47
@Hoxtygen do it right before you add the new data if you like
You can do it like this:
var outputContainer = document.getElementById('output') //<--- existing line
outputContainer.innerHTML = '' // <--- new line
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:50
@cmccormack thank you, it worked
CamperBot
@camperbot
Jan 17 2018 21:50
hoxtygen sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1296 | @cmccormack |http://www.freecodecamp.org/cmccormack
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:51
@BlackMG27 thank you man, the storm is over now
CamperBot
@camperbot
Jan 17 2018 21:51
hoxtygen sends brownie points to @blackmg27 :sparkles: :thumbsup: :sparkles:
:cookie: 213 | @blackmg27 |http://www.freecodecamp.org/blackmg27
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:51
@cmccormack @BlackMG27 and now the final problem. how do you handle the autocompletion?
Christopher McCormack
@cmccormack
Jan 17 2018 21:52
Is that a requirement for this application?
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:52
@cmccormack yes, was part of the user story
Christopher McCormack
@cmccormack
Jan 17 2018 21:54
Is this in the beta? I don't see that user story
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:54
@cmccormack no, maybe its just my imagination. thought i saw it mentioned in the video
Christopher McCormack
@cmccormack
Jan 17 2018 21:55
@Hoxtygen you can try it out but I recommend moving on instead, there will be time to learn autocomplete later on projects that can utilize it better
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:56
@cmccormack thanks man. Now onto twitch tv api
CamperBot
@camperbot
Jan 17 2018 21:56
hoxtygen sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
api offline
Christopher McCormack
@cmccormack
Jan 17 2018 21:56
That said, it looks like jQuery UI has a pretty simple implementation - https://jqueryui.com/autocomplete/ but you still need to provide the lookup data
@Hoxtygen yup move on! So much more to learn!
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:57
@cmccormack yeah, saw that too while doing a bit of googling. but I want vanilla js
Christopher McCormack
@cmccormack
Jan 17 2018 21:58
You can look at the source code for most jquery stuff but it may take a while
Idowu Wasiu
@Hoxtygen
Jan 17 2018 21:58
@cmccormack and i'm kinda surprise at a trend i'm seeing. when researching for each of the project i got to notice people move towards jquey. didnt understand why
Christopher McCormack
@cmccormack
Jan 17 2018 21:58
lots of dependent modules you would also have to convert
jquery has been around a long time and simplifies tasks that would normally take longer, that's why
jquery is also more performant because they're building on the shoulders of solid algorithms and implementations
Idowu Wasiu
@Hoxtygen
Jan 17 2018 22:01
@cmccormack Oh, made an end of the year pact with myself last december to only learn and use vanilla js for my projects. However, its not been fun at all
Christopher McCormack
@cmccormack
Jan 17 2018 22:01
Nothing wrong with using external modules, the bigger your app the better they will come in handy
Idowu Wasiu
@Hoxtygen
Jan 17 2018 22:02
@cmccormack Okay. will learn more vanilla then move on to jquery then
Christopher McCormack
@cmccormack
Jan 17 2018 22:02
Vanilla JS is only going to take you so far, there isn't all that much to learn. Once you have experience with something like doing xmlhttprequests, you can use something simpler like fetch/axios/jquery instead to greatly simplify your next implementation
Jason Luboff
@JLuboff
Jan 17 2018 22:02
Honestly... I have my front and back end certs...and I don't think a single project I stuck with vanilla js..almost always used jquery..
Idowu Wasiu
@Hoxtygen
Jan 17 2018 22:04
@JLuboff @cmccormack read somewhere sometimes ago where it was advised to learn vanilla first before moving onto libraries. thought it was a general consensus
Adam Bohannon
@abohannon
Jan 17 2018 22:04
@Hoxtygen that's what I've done. Intentionally avoided jQuery.
Kaz Baig
@kbaig
Jan 17 2018 22:05
@Hoxtygen biggest reason to learn vanilla is to learn why to not use vanilla
Christopher McCormack
@cmccormack
Jan 17 2018 22:05
@Hoxtygen it's good to understand how to implement something in javascript, but once you know how I see no harm using more powerful libraries
@kbaig :D
Kaz Baig
@kbaig
Jan 17 2018 22:05
in addition to understanding how things work on the lowest level of js
Jason Luboff
@JLuboff
Jan 17 2018 22:05
It is good to know, but I think too many make it out to be evil to use anything but vanilla. Doesn't make you anyless of a programmer IMO
Idowu Wasiu
@Hoxtygen
Jan 17 2018 22:06
@JLuboff I owe you a brownie. you saved my ass when my api is coming up empty, thank you
CamperBot
@camperbot
Jan 17 2018 22:06
hoxtygen sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2300 | @jluboff |http://www.freecodecamp.org/jluboff
Jason Luboff
@JLuboff
Jan 17 2018 22:06
@Hoxtygen Thanks for the brownie :)
CamperBot
@camperbot
Jan 17 2018 22:06
jluboff sends brownie points to @hoxtygen :sparkles: :thumbsup: :sparkles:
:cookie: 353 | @hoxtygen |http://www.freecodecamp.org/hoxtygen
Kaz Baig
@kbaig
Jan 17 2018 22:06
Some people on r/webdev claim to write their own 'barebones frameworks' in vanilla
And they come off as such elitists
Jason Luboff
@JLuboff
Jan 17 2018 22:08
@kbaig Who do they think they are? Richard Hendricks?
Christopher McCormack
@cmccormack
Jan 17 2018 22:09
In my opinion if you're not using all the tools you have available then you aren't being efficient. You want to deliver a product quickly
Idowu Wasiu
@Hoxtygen
Jan 17 2018 22:09
@JLuboff would've given out a thousand brownies that day if i could. Was such a big relief
Kaz Baig
@kbaig
Jan 17 2018 22:09
@JLuboff richard hendricks would be a bit busy breaking theoretical limits to redo what people have already conveniently maxed out
Christopher McCormack
@cmccormack
Jan 17 2018 22:10
Here you go - build your own React - https://hackernoon.com/build-your-own-react-48edb8ed350d
Jason Luboff
@JLuboff
Jan 17 2018 22:10
@Hoxtygen Thats what our little (use to be a lot bigger :cry: ) community is all about
@kbaig ;)
Idowu Wasiu
@Hoxtygen
Jan 17 2018 22:11
@cmccormack the problem is knowing what to believe, jquery has been said to be way overused, bloats code and lots of things i cant even remember, i kinda asked myself how come jquery is still around with all this negativity
Christopher McCormack
@cmccormack
Jan 17 2018 22:12
@Hoxtygen just figure it out for yourself. If you don't like using it then use something else, just don't let others tell you how you should learn
jquery minified is still smaller than most React apps, that I know
Jason Luboff
@JLuboff
Jan 17 2018 22:13
@cmccormack Aren't we telling him how he should learn? :P
Christopher McCormack
@cmccormack
Jan 17 2018 22:14
@JLuboff maybe, but I'm more on the side of try everything and build your own opinions rather than listen to amateurs complain about tools they don't use
Jason Luboff
@JLuboff
Jan 17 2018 22:14
YES! Finally got my code working.
@cmccormack Amateurs? I'd put myself as a rookie still
Christopher McCormack
@cmccormack
Jan 17 2018 22:14
@JLuboff I didn't mean us :)
Kaz Baig
@kbaig
Jan 17 2018 22:14
I'm a garbage can, let alone a human amateur
Christopher McCormack
@cmccormack
Jan 17 2018 22:15
anyways I have to run, smell you later
Kaz Baig
@kbaig
Jan 17 2018 22:16
Ew you like smelling garbage
Jason Luboff
@JLuboff
Jan 17 2018 22:16
@cmccormack :wave:
Jason Luboff
@JLuboff
Jan 17 2018 22:33
Dang. Github is $7/month to have private repos
FlashHero
@FlashHero
Jan 17 2018 22:45

So I need some help, been on this es6 challenge for about half an hour


function getLength(str) {
  "use strict";

  // change code below this line
  const {length} = str; // change this
  // change code above this line
  return length; // you must assign length to len in line

}

console.log(getLength('FreeCodeCamp'));

I don't know whaaaat is wrong with this solution to ES6: Use Destructuring Assignment to Assign Variables from Objects challenge

Kaz Baig
@kbaig
Jan 17 2018 22:50
@FlashHero that's right, should be a beta site error
Diego Mayer
@Chrono79
Jan 17 2018 23:05
@FlashHero
function getLength(str) {
  "use strict";

  // change code below this line
  const { length: len } = str; // change this
  // change code above this line

  return len; // you must assign length to len in line

}
It works, you changed the code and didn't do what they asked exactly
See the last comment line
Kaz Baig
@kbaig
Jan 17 2018 23:59
o didn't see that comment good catch lol