These are chat archives for FreeCodeCamp/Help

9th
Sep 2018
@thekholm80 @ezioda004 what is the trick to get shortest length?
how did you folks solved it?
any hints
f=s=>{let a=0,b=256;for(i in s){a+=s.charCodeAt(i)}return[a%b,a*2%b,a*3%b,a*4%b]}
Aditya
@ezioda004
Sep 09 2018 01:37
I used .map() with .reduce()
Karma Drukpa
@coderkarma
Sep 09 2018 01:41
what do you think we could do here to refactor?
https://www.hackerrank.com/challenges/bigger-is-greater/problem @ezioda004 this was pretty challenging for me
glitz20
@glitz20
Sep 09 2018 01:55
@ezioda004 I am using float but it doesn't seem to work
<div className="row">

                        <div className="col-xs-3 aa">
                            <Link to="/" className="btn btn-link text-secondary">
                                home
                            </Link>
                        </div>
.aa{
    border-color:white;
    border-style:solid;
    border-width:thick;
    float:left

}
jsjoe82
@jsjoe82
Sep 09 2018 02:46
@sabin20 Did you try using display: block?
Aditya
@ezioda004
Sep 09 2018 04:31
@coderkarma I cant tell how to refactor without looking at the code.
@sabin20 .row has display: flex so float wont work on it.
Dingbin
@tobeforgetten
Sep 09 2018 06:32
<p>anchor text<a href="http://freecatphotoapp.com"> cat photos</a> for you to follow.</p>
my code doesn't work
Is there anyone can help me ?
Kranti Nebhwani
@darkphotonKN
Sep 09 2018 06:34
Hey guys, does anyone have an idea where if i animate an object off a page for it to not "stick outside" of the borders or the page / any parent object. So that once it's past the borders it doesnt show up (the areas of the object outside the borders of it's parents)
Karma Drukpa
@coderkarma
Sep 09 2018 06:58
f=s=>{let a=0,b=256;for(i in s){a+=s.charCodeAt(i)}return[a%b,a*2%b,a*3%b,a*4%b]}
@ezioda004 that was the code.
Aditya
@ezioda004
Sep 09 2018 07:05
@coderkarma I meant the code for the hackerank problem you posted. For this one you have to use .map or similar methods to loop
@tobeforgetten What error are you getting?
psyperl
@psyperl
Sep 09 2018 08:49
is Wikipedia changed UI ? just realized that
oops nevermind, i was seeing the mobile version
psyperl
@psyperl
Sep 09 2018 10:09
wonder what 'Unhandled Promise Rejection' is
ahh i need an extra catch on fetch
ifysucre
@ifysucre
Sep 09 2018 10:37
hello all. I am new on here would appreciate some help regarding leaving a particular task on FCC.
The question is-----The main element should have two paragraph elements as children.
I cannot seem to get theat particular task right
Julian Zhu
@OrangeBorning
Sep 09 2018 10:39
<div>
   <p></p>
   <p></p>
</div>
@ifysucre
paragraph elements <p></p>
ifysucre
@ifysucre
Sep 09 2018 10:40
hey @OrangeBorning let me try this
thankyou
Julian Zhu
@OrangeBorning
Sep 09 2018 10:40
<3
ifysucre
@ifysucre
Sep 09 2018 10:42
its still not working
Julian Zhu
@OrangeBorning
Sep 09 2018 10:43
show me u code
Screenshot below
ifysucre
@ifysucre
Sep 09 2018 10:44
kitty ipsum text.JPG
Julian Zhu
@OrangeBorning
Sep 09 2018 10:44
image.png
No p1
ifysucre
@ifysucre
Sep 09 2018 10:45
oh okay
just pagain?
Julian Zhu
@OrangeBorning
Sep 09 2018 10:45
paragraph elements just <p></p>
ifysucre
@ifysucre
Sep 09 2018 10:59
right
let me correct myself & get bak to you
Julian Zhu
@OrangeBorning
Sep 09 2018 10:59
ok
ifysucre
@ifysucre
Sep 09 2018 11:00
OMG!!! @OrangeBorning you are the best.... I have literally been struggling with it for like a week now. Thank you so much
Basic knowledge is very important
Have a good day
jsjoe82
@jsjoe82
Sep 09 2018 11:02
@ifysucre Don't feel too bad. I'm still only barely beyond a beginner stage myself, but when I very first started, those types of mistakes were about 50% of what was holding me back. I'd realize it, see it, correct it and sit there all >=(
ifysucre
@ifysucre
Sep 09 2018 11:03
@OrangeBorning Thank you so much
@ifysucre Don't feel too bad. I'm still only barely beyond a beginner stage myself, but when I very first started, those types of mistakes were about 50% of what was holding me back. I'd realize it, see it, correct it and sit there all >=(thanks. I will do better
Julian Zhu
@OrangeBorning
Sep 09 2018 11:03
I am very glad that your problem has been solved.
May Kittens Devour Your Soul
@diomed
Sep 09 2018 11:32
just p as paimon
psyperl
@psyperl
Sep 09 2018 11:49
been scratching my head for hours just because one of the object/script i have fixed kept hitting the cache
ifysucre
@ifysucre
Sep 09 2018 12:20
hello again...Please I would like to know what error is in the screenshot below...
kitty ipsum.JPG
Thank you
psyperl
@psyperl
Sep 09 2018 12:29
'' is not the same as "
you need double quotes surrounding the url instead of 2x single quotes
Screen Shot 2018-09-09 at 19.30.12.png
May Kittens Devour Your Soul
@diomed
Sep 09 2018 12:46
@ifysucre haha- you cheetah!
@psyperl can't be fooled :smirk_cat:
HawkEye @psyperl we call him
ifysucre
@ifysucre
Sep 09 2018 12:50
thabks very much @psyperl
psyperl
@psyperl
Sep 09 2018 12:56
@ifysucre :thumbsup:
May Kittens Devour Your Soul
@diomed
Sep 09 2018 14:26

Happy 9-9 day, you guys!

creeps
@winnypie_twitter
Sep 09 2018 14:59
Hello. I'm making a command line application with commander, inquirer and nightwatch as top dependencies. The main purpose of the app is for automation and testing.. Is there any way i can make this distributable instead of publishing it via npm
Kyle Holm
@thekholm80
Sep 09 2018 15:00
github
yarn
creeps
@winnypie_twitter
Sep 09 2018 15:01
No i mean like in python where you can run install it and run it locally
Kyle Holm
@thekholm80
Sep 09 2018 15:01
as an executable?
if you're doing it in javascript, the only way i'm aware of is electron
creeps
@winnypie_twitter
Sep 09 2018 15:02
maybe anyways
im using node
May Kittens Devour Your Soul
@diomed
Sep 09 2018 15:44
@thekholm80 react vs vue
Kyle Holm
@thekholm80
Sep 09 2018 15:50
@diomed that was pretty violent
and why aren't the shepherds wearing pants?
May Kittens Devour Your Soul
@diomed
Sep 09 2018 15:54
whaat? didn't even notice
Niraj Nandish
@Nirajn2311
Sep 09 2018 16:28
@diomed hows css going?
Srinath
@Srinath-V-S
Sep 09 2018 16:44
can someone explain when to use accessing Object Properties with Bracket Notation and dot notation?
psyperl
@psyperl
Sep 09 2018 16:45
when you do know the property name then you should use dot notation
Kyle Holm
@thekholm80
Sep 09 2018 16:45
@Srinath-V-S if you know the name of the property you want to access object.propertyName if you don't know (like in a variable) object[variableName]
psyperl @psyperl read how to type fast in 30 days
Niraj Nandish
@Nirajn2311
Sep 09 2018 16:50
@thekholm80 how do you change the color of your message when you type
Kyle Holm
@thekholm80
Sep 09 2018 16:50
magic, mostly
psyperl
@psyperl
Sep 09 2018 16:51
lol
Kyle Holm
@thekholm80
Sep 09 2018 16:51
for inline code format use `` code ``
for code blocks
```
code
```
psyperl
@psyperl
Sep 09 2018 16:52
usually just use one backtick for inline
Kyle Holm
@thekholm80
Sep 09 2018 16:52
so lazy
what do you do with all that time you save?
psyperl
@psyperl
Sep 09 2018 16:52
heh
Kyle Holm
@thekholm80
Sep 09 2018 16:52
:joy:
psyperl
@psyperl
Sep 09 2018 16:56
aww \color{cyan}aww
psyperl
@psyperl
Sep 09 2018 17:02
no idea why it reset after the first letter
learningjs42
@learningjs42
Sep 09 2018 17:09
hello all can someone write this code without the template literals but with normal notation :
const JSON_to_CSV = (arr, columns, delimiter = ',') =>
  [
    columns.join(delimiter),
    ...arr.map(obj =>
      columns.reduce(
        (acc, key) => `${acc}${!acc.length ? '' : delimiter}"${!obj[key] ? '' : obj[key]}"`,
        ''
      )
    )
  ].join('\n');
psyperl
@psyperl
Sep 09 2018 17:10
how are we suppose to read that code.. can that be formatted with triple backticks instead?
learningjs42
@learningjs42
Sep 09 2018 17:11
@psyperl sorry :)
psyperl
@psyperl
Sep 09 2018 17:13
${acc}${!acc.length ? '' : delimiter}"${!obj[key] ? '' : obj[key]}" that is the literals in question?
that is actually a cool literals i've never uses that
Niraj Nandish
@Nirajn2311
Sep 09 2018 17:17
Has anyone used material-ui
psyperl
@psyperl
Sep 09 2018 17:18
maybe acc + (!acc.length ? '' : delimiter) + "\""+ (!obj[key] ? '' : obj[key]) +"\"" @learningjs42 .. not sure.. that code kinda crippled
learningjs42
@learningjs42
Sep 09 2018 17:20
@psyperl thnaks but i dont really get it
what do you mean with crippled
learningjs42
@learningjs42
Sep 09 2018 17:20
@psyperl thanks
psyperl
@psyperl
Sep 09 2018 17:21
crippled as in many notation in it .. head hurts lol
why not just leaving it that way?
learningjs42
@learningjs42
Sep 09 2018 17:22
im learning from it its a learning project i try to understand this code
psyperl
@psyperl
Sep 09 2018 17:24
do you understand this code?
const greet = `hello ${someone ? someone : 'there'}`
learningjs42
@learningjs42
Sep 09 2018 17:26
@psyperl no not really can you explain ?
psyperl
@psyperl
Sep 09 2018 17:27
how about this one?
const greet = "hello " + ( someone ? someone : 'there' )
learningjs42
@learningjs42
Sep 09 2018 17:29
yes the last one i understand
psyperl
@psyperl
Sep 09 2018 17:29
it is the same result.. string literals allows you to perfom thingy inside the ${}
learningjs42
@learningjs42
Sep 09 2018 17:30
@psyperl thanks its a lot more clear now :)
psyperl
@psyperl
Sep 09 2018 17:30
that's good to hear
@learningjs42 :thumbsup:
learningjs42
@learningjs42
Sep 09 2018 17:31
im gonna play wit it in the console a bit :)
psyperl
@psyperl
Sep 09 2018 17:31
ok
i actually just learnt that myself just now haha
gonna use it next time
May Kittens Devour Your Soul
@diomed
Sep 09 2018 17:40
look, guys: Croatia
:smile_cat:
psyperl
@psyperl
Sep 09 2018 17:41
wonder what you've been searching on github @diomed :D
May Kittens Devour Your Soul
@diomed
Sep 09 2018 17:43
ha! nothing, really. I actually follow egoist, coz he makes all the vue stuff.
that guy is one effin coding machine
May Kittens Devour Your Soul
@diomed
Sep 09 2018 18:14
KaTeX parse error: Expected 'EOF', got '}' at position 23: cyan}aww\{cyan}̲ :  \color{cyan}aww\{cyan} 
of course. only diomed can get an error in gitter, coz only diomed can F up things so badly
psyperl
@psyperl
Sep 09 2018 18:16
lol yeah.. i tried that.. can't get full text in color
dunno how yet
May Kittens Devour Your Soul
@diomed
Sep 09 2018 18:33
anyone here who knows python :snake:
Bjorn van de Peut
@bjorno43
Sep 09 2018 18:36
@psyperl No idea what happend with the Bot. It just shut down. No error or anything. Looks like some default php inactivity timeout or something
psyperl
@psyperl
Sep 09 2018 18:37
oh
May Kittens Devour Your Soul
@diomed
Sep 09 2018 18:37
shut down for the good of mankind
@bjorno43 you know C# right?
Bjorn van de Peut
@bjorno43
Sep 09 2018 18:38
@diomed Reasonably ye
I mean, C# is so freaking huge that it's nearly impossible to know all of it, ghehe
May Kittens Devour Your Soul
@diomed
Sep 09 2018 18:41
gonna pm u smth
Bjorn van de Peut
@bjorno43
Sep 09 2018 18:42
@psyperl Ye some other issue with the bot as well that I just can't figure out. It should rotate through all available challenges before repeating one again. But it doesn't. According to my debug info it should work fine, but it just doesn't. Kinda kills me, ghehe
I have an empty array. Everytime a challenge gets solved, it's id is pushed to that array. This works fine. Array outputs the expected id's when debugging.
Then I have this query: SELECT id FROM challenges WHERE id NOT IN (array_here) AND status = 2 ORDER BY RAND() LIMIT 1
psyperl
@psyperl
Sep 09 2018 18:47
did you put that query in variable?
Bjorn van de Peut
@bjorno43
Sep 09 2018 18:47
So lets say I have the id's 1,2,3,4,5 and the array has 2,3,4. Obviously the code puts the array into a string seperated by a comma
The query becomes this: SELECT id FROM challenges WHERE id NOT IN (2, 3, 4) AND status = 2 ORDER BY RAND() LIMIT 1. If I run that against my database directly, I only get 1 or 5 returned. If I remove the LIMIT 1, I get both 1 and 5 returned
psyperl
@psyperl
Sep 09 2018 18:48
if you do probably the array_here doesn't reflect the current array.. but it's state is the one when you assign it to var
Bjorn van de Peut
@bjorno43
Sep 09 2018 18:50
Ye but that's the thing. I can directly debug it so it returns me the current values in the console. And it returns the values I'm expecting
Except that it just selects one that's already in the list and adds it to the array. So the array becomes 2, 3, 4, 2.. cause it selected 2 again. Which shouldn't be possible
psyperl
@psyperl
Sep 09 2018 18:53
have you tried to watch value of $challenges all the time? before that query runs
Bjorn van de Peut
@bjorno43
Sep 09 2018 18:55
Ye, this was basicly my code while debugging:
$query = "SELECT id FROM challenges WHERE id NOT IN (:challenges) AND status = 2 ORDER BY RAND() LIMIT 1";
print_r($challengeIds); // 2, 3, 4
$data = array(array(":challenges", implode(',', $challengeIds)));
$result = dbQuery('single', $query, $data, $db);
print_r($challengeIds); // 2, 3, 4, 2
psyperl
@psyperl
Sep 09 2018 18:56
i was worried about the state of the $challenge .. not worry wether that code is correct or not
possibly the content is not the array you expected
your query is fine
also maybe prepared statement is safer?
Bjorn van de Peut
@bjorno43
Sep 09 2018 18:58
That is using prepared statements :)
psyperl
@psyperl
Sep 09 2018 18:59
ah lol, been a while since i've seen php sorry
Bjorn van de Peut
@bjorno43
Sep 09 2018 19:00
Well it's not the conventional way of doing it. I basicly wrote a function that handles it instead of doing it manually every single time
psyperl
@psyperl
Sep 09 2018 19:01
$db->query("SELECT id FROM challenges WHERE id NOT IN (".implode(',', $challenges).") AND status = 2 ORDER BY RAND() LIMIT 1");
seems direct
Bjorn van de Peut
@bjorno43
Sep 09 2018 19:02
No, this is a call to my function dbQuery('single', $query, $data, $db);
single = This query only returns 1 row
query = The query (using named parameter :challenges here)
data = Multidimensional array holding the data for the each parameter
db = Database object
psyperl
@psyperl
Sep 09 2018 19:03
we are talking about run.php line 279?
Bjorn van de Peut
@bjorno43
Sep 09 2018 19:04
Don't look at the github. I haven't updated it with this one yet
psyperl
@psyperl
Sep 09 2018 19:04
ah ok
Bjorn van de Peut
@bjorno43
Sep 09 2018 19:04
Wait, I'll update it
@psyperl Alright, should be updated
psyperl
@psyperl
Sep 09 2018 19:11
how did you get extra 2 wew print_r($challengeIds); // 2, 3, 4, 2
Bjorn van de Peut
@bjorno43
Sep 09 2018 19:12
That was just an example
It happens at line 395. That's the array with the id's that have already been used.
Then, if you look at line 398, it should not be possible to contain a number that's inside that array. Yet it does
psyperl
@psyperl
Sep 09 2018 19:18
strange
i couldn't capture what's wrong
Bjorn van de Peut
@bjorno43
Sep 09 2018 19:19
Yup. Exactly my problem
This is really one of those "it shouldn't be happening" problems, lol
May Kittens Devour Your Soul
@diomed
Sep 09 2018 19:47
#that'swhatshesaid
May Kittens Devour Your Soul
@diomed
Sep 09 2018 20:07
what'ss that database @thekholm80 is always using?
Kyle Holm
@thekholm80
Sep 09 2018 20:08
super amazing db
May Kittens Devour Your Soul
@diomed
Sep 09 2018 20:11
mongo , is it?
Kyle Holm
@thekholm80
Sep 09 2018 20:12
yeah
Karma Drukpa
@coderkarma
Sep 09 2018 20:30
HackerRank challenges are quite tough comparing codewars
May Kittens Devour Your Soul
@diomed
Sep 09 2018 20:30

&.

lonely operator
Aditya
@ezioda004
Sep 09 2018 20:31
|>
learningjs42
@learningjs42
Sep 09 2018 20:33

hello all can someone help me explain this part :

 Object.values(obj).reduce((acc, val) => {
        if (acc !== undefined) return acc;
        if (typeof val === 'object') return dig(val, target);
      }, undefined);

of this total code

//#Source https://bit.ly/2neWfJ2
const dig = (obj, target) =>
  target in obj
    ? obj[target]
    : Object.values(obj).reduce((acc, val) => {
        if (acc !== undefined) return acc;
        if (typeof val === 'object') return dig(val, target);
      }, undefined);

const data = {
  level1: {
    level2: {
      level3: 'some data'
    }
  }
};

const dog = {
    "status": "success",
    "message": "https://images.dog.ceo/breeds/african/n02116738_1105.jpg"
}
console.log(dig(data, 'level3'));
console.log(dig(data, 'level4'));
console.log(dig(dog, 'message'));
Aditya
@ezioda004
Sep 09 2018 20:33
@coderkarma Did you solve the one from yesterday?
@learningjs42 Seems like you're finding the value from the level passed to dig()'s 2nd argument via recursion
learningjs42
@learningjs42
Sep 09 2018 20:39
@ezioda004 yes but i dont get the flow
@ezioda004 can you maybe comment the code
why checking if not unefined ? and what its returnuing if its returning acc
  if (acc !== undefined) return acc;
Aditya
@ezioda004
Sep 09 2018 20:42
Thats basically saying if the value is already found then acc wont be undefined anymore, therefore we wont need further recursion, so you can make the loop short circuit with if (acc !== undefined) return acc;
Karma Drukpa
@coderkarma
Sep 09 2018 20:44
@ezioda004 character less then >=70 one?
I couldn't shrink down to 70 character
only 80s
learningjs42
@learningjs42
Sep 09 2018 20:45
@ezioda004 thanks but i still dont get it 100% can you help me comment out this code
Aditya
@ezioda004
Sep 09 2018 20:55
@learningjs42
function dig(obj, target){
  for (let key in obj) { //loop through object
    if (target == key){ //if key found, return it
      return obj[target];
      }
    else {
      if (typeof obj[key] == "object"){ //otherwise go deeper
        let x = dig(obj[key], target) //  <-- recursion here
        if (x !== "not found") return x; //if the deeper object found data return it, else continue loop
      }
    }
  }
  return "not found";
}
learningjs42
@learningjs42
Sep 09 2018 20:55
@ezioda004 thanks :) im gonna take a look at it
Aditya
@ezioda004
Sep 09 2018 20:55
@coderkarma No, hackerrank one
Karma Drukpa
@coderkarma
Sep 09 2018 21:12
@ezioda004 oh man, that was tough one. I was actively googling, nope I didn't solve it
have you?
psyperl
@psyperl
Sep 09 2018 21:52
i just realized 'Basic HTML and HTML5' doesn't mentioned table at all
maybe table is just obsoleted?
Kyle Holm
@thekholm80
Sep 09 2018 21:53
i think it still has it's use, but not nearly as much as it used to
psyperl
@psyperl
Sep 09 2018 21:55
so that means i need to be better at flexbox @thekholm80 ?
it feels weird, i am so used to tables
Kyle Holm
@thekholm80
Sep 09 2018 21:58
i think a table-like structure would be pretty simple with css grid
a little more difficult with flexbox
psyperl
@psyperl
Sep 09 2018 21:58
ok will look up css grid thanks
Kyle Holm
@thekholm80
Sep 09 2018 21:59
i think fcc has a section on grid
psyperl
@psyperl
Sep 09 2018 21:59
it has yes
learningjs42
@learningjs42
Sep 09 2018 22:03

why does this code:

let test = 123;
let test2 =[...`${test}`]
console.log(test2) //[1,2,3]

make a array with each integer in its own index and not just [123
]

Kyle Holm
@thekholm80
Sep 09 2018 22:04
because you're spreading a string
learningjs42
@learningjs42
Sep 09 2018 22:04
if you spread a string this always the behaviour of javascript?
@thekholm80 thanks
Kyle Holm
@thekholm80
Sep 09 2018 22:04
const str = 'hello';
const arr = [...str]; // ['h', 'e', 'l', 'l', 'o'];
psyperl
@psyperl
Sep 09 2018 22:06
@pdurbin that is one of the series yes thank you
learningjs42
@learningjs42
Sep 09 2018 22:06
@thekholm80 thanks a lot :)
Aditya
@ezioda004
Sep 09 2018 22:06
@coderkarma I didnt try, but it looked interesting
@learningjs42 Yes, strings have @@iterable property so they are iterables
Philip Durbin
@pdurbin
Sep 09 2018 22:07
Ok. I've been enjoying these CSS Grid videos by Jen Simmons: https://www.youtube.com/channel/UC7TizprGknbDalbHplROtag/videos
psyperl
@psyperl
Sep 09 2018 22:09
awesome
learningjs42
@learningjs42
Sep 09 2018 22:11
@ezioda004 thanks :)
i have another question can someone comment this code :
const pull = (arr, ...args) => {
  let argState = Array.isArray(args[0]) ? args[0] : args;
  let pulled = arr.filter((v, i) => !argState.includes(v));
  arr.length = 0;
  pulled.forEach(v => arr.push(v));
  return pulled;
};
let arra1 = ['a', 'b', 'c', 'a', 'b', 'c'];
console.log(pull(arra1, 'a', 'c'));
let arra2 =  ['a', 'b', 'c', 'a', 'b', 'c'];
console.log(pull(arra2, 'b'));
Aditya
@ezioda004
Sep 09 2018 22:15
Mutating the argument, probably not the best idea :thought_balloon:
@learningjs42 Why mutate arr and still return pulled?
learningjs42
@learningjs42
Sep 09 2018 22:24
@ezioda004 im sorry i get this code from 3wschools its the solution of them
what had you will done in this situation ?
3wresource im sorry
Write a JavaScript program to filter out the specified values from an specified array. Return the original array without the filtered values.
Aditya
@ezioda004
Sep 09 2018 22:40
@learningjs42 Ah in that case, its fine. Usually keeping the functions pure is the best practice in FP. Do you still need comments for the above snippet?
learningjs42
@learningjs42
Sep 09 2018 22:41
@ezioda004 yes if you can help me out with the comment it will be great :)
Aditya
@ezioda004
Sep 09 2018 22:46
@learningjs42
const pull = (arr, ...args) => {
  let argState = Array.isArray(args[0]) ? args[0] : args; // Checking if the filtered items are passed as array or spread, assigning to argState accordingly
  let pulled = arr.filter((v, i) => !argState.includes(v)); // Making a new filtered array with the elements removed
  arr.length = 0; //Making the size of the arr 0, its still the same array in the memory
  pulled.forEach(v => arr.push(v)); // Copying elements from pulled array to arr
  return pulled; // Returning the pulled array
};
learningjs42
@learningjs42
Sep 09 2018 22:47
@ezioda004 thanks a lot im gonna study it !!
Aditya
@ezioda004
Sep 09 2018 22:48

Return the original array without the filtered values.

The last line I think should be return arr; since we're going through all the trouble to keep arr reference same..so it'd make sense to return that aswell.

Kyle Holm
@thekholm80
Sep 09 2018 22:49

or just simply

const pull = (arr, ...args) => {
  let argState = Array.isArray(args[0]) ? args[0] : args;
  return arr.filter((v, i) => !argState.includes(v));
}

unless i'm missing something

learningjs42
@learningjs42
Sep 09 2018 22:50
@ezioda004 thanks for the advice im gonna test it in the console also with that return @thekholm80 i dont know if you missing something out maybe @ezioda004 can take a look at your suggestion
@thekholm80 thanks
Aditya
@ezioda004
Sep 09 2018 22:50
@thekholm80 Yeah thats how it should be but they said "Return original array" so I'm guessing they want the original array in reference?
Kyle Holm
@thekholm80
Sep 09 2018 22:51
hmm
Aditya
@ezioda004
Sep 09 2018 22:51
With arr.length = 0 it'll still be the same array in memory
Kyle Holm
@thekholm80
Sep 09 2018 22:51
i guess i don't understand the benefit of returning the original array
Aditya
@ezioda004
Sep 09 2018 22:52
¯_(ツ)_/¯
Kyle Holm
@thekholm80
Sep 09 2018 22:52
my functions are little data factories. raw stuff goes in, shiny new stuff comes out. i dislike repair shops where you send back a fixed up version of what goes in
and your dude's missing an arm lol ¯\_(ツ)_/¯
poor little fella
Aditya
@ezioda004
Sep 09 2018 22:53
It keeps falling off
Kyle Holm
@thekholm80
Sep 09 2018 22:53
lol 3 \ becomes 2
Aditya
@ezioda004
Sep 09 2018 22:53
Thanks
¯_(ツ)_/¯\\
Fixed it :D
Kyle Holm
@thekholm80
Sep 09 2018 22:54
the horror
Aditya
@ezioda004
Sep 09 2018 22:55
The only benefit I can think of returning the same array mutated is for testing purpose? Like you check if the same array is mutated properly and someone has not hardcoded a new array, but even that is very far fetched
Kyle Holm
@thekholm80
Sep 09 2018 22:56
i'm sure there's a plausible use-case. i'm still a noob so there's tons of stuff i've never encountered before
and they invent more every day
Aditya
@ezioda004
Sep 09 2018 22:58
Tru dat, but like you said I like keeping functions pure too, easier to debug, easy life
@thekholm80 This is an interesting proposal https://github.com/binast/ecmascript-binary-ast
Kyle Holm
@thekholm80
Sep 09 2018 23:03
not cool. the AP Style guide says any time you use an acronym, you should write the full words out the first time they appear. then i'm not stuck on wikipedia trying to sort out if AST is abstract syntax tree or asynchronous system trap
but my whining aside, i'm not sure what this would mean
we'd compile our source to binary and serve that?
oh, this is all WASM's fault, it seems
Aditya
@ezioda004
Sep 09 2018 23:06
Hah, it is Abstract Syntax Tree, it means we'll help the browsers out, they usually have few steps while compiling like Tokenization, Creating AST, lexing etc
Kyle Holm
@thekholm80
Sep 09 2018 23:06
interesting
most of it's over my head though
Aditya
@ezioda004
Sep 09 2018 23:07
Not sure if this is WASM fault, it'd make JS compiling really fast though
For parsing desktop facebook.com, 10-15% of client-side CPU time is spent parsing JavaScript. The prototype we implemented reduced time to build the AST by 70-90%.
Thats definitely huge
Kyle Holm
@thekholm80
Sep 09 2018 23:08
that just means that web apps will get bigger
remember when Bill Gates said nobody will ever need more than 640k ram?
Aditya
@ezioda004
Sep 09 2018 23:09
Lol, and here I'm with 8gb ram not cutting it
Kyle Holm
@thekholm80
Sep 09 2018 23:10
lol
Aditya
@ezioda004
Sep 09 2018 23:11
Also seems like we might get a standard JS library
Theres so many cool proposals
Still stage 1, so not next year
Kyle Holm
@thekholm80
Sep 09 2018 23:12
oh sweet, they're going to give us foo.js
i use foo all the time
Aditya
@ezioda004
Sep 09 2018 23:13
And then you overwrite foo and wonder why the import isnt working :d
Andrew Tait Gehrhardt
@atgehrhardt
Sep 09 2018 23:45
Hey guys, I have a super dumb questions. https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/word-blanks/ I cannot seem to figure out the solution for this for the life of me. The posted solution in the help section is also incorrect. This is my current solution:

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
// Your code below this line
var result += "The " + myAdjective + " " + myNoun + " " + myVerb + " " + myAdverb + ".";

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly”);

Sorry, thanks!
Aditya
@ezioda004
Sep 09 2018 23:53
@atgehrhardt Remove + from var result +=, otherwise it'd concatenate undefined to the strings
Andrew Tait Gehrhardt
@atgehrhardt
Sep 09 2018 23:58
@ezioda004 THANK YOU! Omg I’ve been so stuck on this and of course the answer is that obvious. Preciate the help!