These are chat archives for FreeCodeCamp/HelpFrontEnd

2nd
Jan 2018
JBallin
@JBallin
Jan 02 2018 00:02
why does this codepen look different when copied exactly into a new codepen (left margin)? also when i delete the css on the initial codepen it doesn't change the styling?
Henry
@GitHub-Henry
Jan 02 2018 00:07
@JBallin codepen has a fork button which will make an exact copy of a pen for you.
image.png
linkin-park
@linkin-park
Jan 02 2018 00:34
hi
why javascript is heck complex
VaseJS
@VaseJS
Jan 02 2018 00:36
@linkin-park its not, just a transition in learning :D
linkin-park
@linkin-park
Jan 02 2018 00:37
it is
its the worst language ever
as start of new year
Array(17).join("1"-2)
:P
linkin-park
@linkin-park
Jan 02 2018 00:42
more realistic
Array(17).join("ab"-2)+" Batman"
Henry
@GitHub-Henry
Jan 02 2018 00:49
@VaseJS YDKJS uses 6 books to explain JS. Is that because the author got paid by the word?
VaseJS
@VaseJS
Jan 02 2018 00:51
@GitHub-Henry lol
one could take that many books to explain many things. some of those books are very short
i've read them
Colin
@finkbeca
Jan 02 2018 00:53
Hi everyone I have a really simple question, using a button and js how should I go about changing a div s background color when the button is checked. I have been messing around with js but have not succeeded yet. Thanks!
linkin-park
@linkin-park
Jan 02 2018 00:58
hello js noobz
VaseJS
@VaseJS
Jan 02 2018 00:58
@finkbeca onclick background-color: ??? for a vague inline option
like that?
someone is feelin' themselves today
Colin
@finkbeca
Jan 02 2018 01:03
Sorry for the late response @VaseJS , I looked at w3 , I have the button set to onclick = "function_name()" and I have this wrote inside the function : Document.getElementById("title1").body.style.color = '#000'; am I missing something silly?
It might just not be my day
VaseJS
@VaseJS
Jan 02 2018 01:04
@finkbeca you have to post your code
Colin
@finkbeca
Jan 02 2018 01:05
@VaseJS ok One second
function colorChange {
    Document.getElementById("title1").body.style.color = '#000';
}
``` this is my js
The html button:
<button onclick = "colorChange()" id="buttonGradientColor">
Random Color
</button>
```
is this all you need?
iso
@iso1048
Jan 02 2018 01:12

@finkbeca try

function colorChange(){
  document.getElementById('title1').style.backgroundColor = '#000';
}
<button onclick='colorChange()' id='buttonGradientColor'>RandomColor</button>

?

Colin
@finkbeca
Jan 02 2018 01:12
I realise colorChang should be colorChange() that is not the issue
@gothamknight I will try this
Colin
@finkbeca
Jan 02 2018 01:18
function colorChange() {
    Document.getElementById("title1").style.backgroundColor = '#000';
}
Changed it a little and still no success
iso
@iso1048
Jan 02 2018 01:20
Are you working on codepen?
Stephen James
@sjames1958gm
Jan 02 2018 01:20
@finkbeca Put a console.log into your function to see if it is even getting called.
it is document (lower case).
Sometimes the javascript is not accessible from HTML, that is why using addEventListener is more reliable
iso
@iso1048
Jan 02 2018 01:21
@sjames1958gm in what cases would the script not be accessible from HTML?
Stephen James
@sjames1958gm
Jan 02 2018 01:22
@gothamknight Some online tools, similar to codepen, wrap the javascript in a function which makes your functions not global
I am not sure if codepen does, but I have seen some that do
iso
@iso1048
Jan 02 2018 01:24
oh I see
Colin
@finkbeca
Jan 02 2018 01:25
@gothamknight I was not but here it is in a quick codepen I made. https://codepen.io/buddyfinkbear/pen/zpzKLX
iso
@iso1048
Jan 02 2018 01:28
@finkbeca myFunction() (you forgot the brackets in the html) - seems to work
Colin
@finkbeca
Jan 02 2018 01:29
@gothamknight yeah, I typed that pretty fast, there was prone to be atleast one mistake. I got to work outside of codepen too. I know it was a silly issue, but thanks for trying to help!
CamperBot
@camperbot
Jan 02 2018 01:29
finkbeca sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 475 | @gothamknight |http://www.freecodecamp.org/gothamknight
Colin
@finkbeca
Jan 02 2018 01:29
@sjames1958gm Thanks as well!
iso
@iso1048
Jan 02 2018 01:30
no problem
@sjames1958gm do you know if there are any costs associated with making a cloud9 account to do the node.js section of fCC?
Stephen James
@sjames1958gm
Jan 02 2018 01:32
I am not a big fan of calling Javascript from HTML. Mainly for the reason that it is sometimes hard to see why/when javascript code is being called if there is not explicit addEventListener in javascript
@gothamknight I have not paid anything. But I did it before AWS bought cloud9
iso
@iso1048
Jan 02 2018 01:34
@sjames1958gm Yeah I tend to use event listeners. Cool. Thanks man
CamperBot
@camperbot
Jan 02 2018 01:34
gothamknight sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8814 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Jan 02 2018 01:35
@gothamknight :+1:
kerafyrm02
@kerafyrm02
Jan 02 2018 01:46
stephen do you know php
Stephen James
@sjames1958gm
Jan 02 2018 01:49
@kerafyrm02 no, not really
Jeff Lung YK
@jefflung
Jan 02 2018 05:18
Hi, I would like to learn Webgl UI for website, but I only found many cool websites with webgl but no tutorial on web about how to create such kind of pretty websites
Jeff Lung YK
@jefflung
Jan 02 2018 08:10
Thanks @GitHub-Henry
CamperBot
@camperbot
Jan 02 2018 08:10
animatist sends brownie points to @github-henry :sparkles: :thumbsup: :sparkles:
:cookie: 520 | @github-henry |http://www.freecodecamp.org/github-henry
elad ben aderet
@eladonline
Jan 02 2018 09:35
Hey all
Is anyone familiar with Phaser ?
hillsie
@Hillsie
Jan 02 2018 11:16
Hi There, How do I go about using a single image that has different clickable area’s. I also want to have the clicked area change colour? What methods should I research? SVG, Which I know very little about? Or is there some other method?
primuscovenant
@primuscovenant
Jan 02 2018 11:20
@heroiczero thx
CamperBot
@camperbot
Jan 02 2018 11:20
primuscovenant sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 2124 | @heroiczero |http://www.freecodecamp.org/heroiczero
Mostafa Gaber
@MostafaGaberr
Jan 02 2018 11:34
Hello guys, I'm new to front-end so I need some help
Markus Kiili
@Masd925
Jan 02 2018 11:34
@MostafaGaberr Hi. Just post the question here.
Mostafa Gaber
@MostafaGaberr
Jan 02 2018 11:35
So I always have issues with my HTML elemnts being so close (no spacing), is margins/padding the only way to solve it?
or bootstrap can do it?
since margins and padding take too much time to reach the spacing I need
Markus Kiili
@Masd925
Jan 02 2018 11:35
@MostafaGaberr Bootstrap grid has some default margin there I believe.
Mostafa Gaber
@MostafaGaberr
Jan 02 2018 11:35
You mean the rows @Masd925 ?
Markus Kiili
@Masd925
Jan 02 2018 11:36
@MostafaGaberr Yes.
Mostafa Gaber
@MostafaGaberr
Jan 02 2018 11:36
I'm having hard times with these rows tbh
Sorin Ruse
@sorinr
Jan 02 2018 11:36
@MostafaGaberr i would go first for plain css to learn how margins/padding works
Mostafa Gaber
@MostafaGaberr
Jan 02 2018 11:37
I did go, and it kinda worked but takes too much time
Sorin Ruse
@sorinr
Jan 02 2018 11:37
what do u mean it takes too much time?
Mostafa Gaber
@MostafaGaberr
Jan 02 2018 11:38
like, to set the margins and padding to that specific numbers you need
it always take time since here would be too many elemnts and you need deffo margins/padding for each
Sorin Ruse
@sorinr
Jan 02 2018 11:40
if u reuse a lot same numbers in marginsor padding just make a class/classes of your own in css and use that classes. see no reason in loading an entire css framework just to set up a few things
Mostafa Gaber
@MostafaGaberr
Jan 02 2018 11:41
Alright, got it.
@sorinr @Masd925 thanks for help!
CamperBot
@camperbot
Jan 02 2018 11:41
mostafagaberr sends brownie points to @sorinr and @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1384 | @sorinr |http://www.freecodecamp.org/sorinr
:star2: 4634 | @masd925 |http://www.freecodecamp.org/masd925
Sorin Ruse
@sorinr
Jan 02 2018 11:41
@MostafaGaberr welcome
hi guys can u please give the explanation of this ?
and i wan t to know why i used the jsonp=? and its use.
if i used the format = json its not working y?
though server can able to response the json
Stephen James
@sjames1958gm
Jan 02 2018 12:16
@1532j0004kg JSONP is a mechanism to get around cross origin limitations.
the jsonp parameter is where a function name is placed which is constructed by server.
jsonp=? tell jquery to supply the function name.
wikipedia has a good description of JSONP -
dinesh
@1532j0004kg
Jan 02 2018 12:19
functionname we defined?
Austin Jess
@ajess33
Jan 02 2018 16:58
Just a quick question, does the order of the URL parameters matter?
Ken Haduch
@khaduch
Jan 02 2018 17:29
@ajess33 - I don't think that it should, other than perhaps the jsonp handler? (just guessing about that one, it might be unique?) But generally speaking, if the URL parameters have a key=value notation, it should be able to be order independent?
Gersho
@Gersho
Jan 02 2018 17:29
the only moment i can think where order matter is if you don't espace characters properly
Stephen James
@sjames1958gm
Jan 02 2018 18:22
@sjames1958gm With jsonp=? the function name is defined by jquery - under the covers, your code gets nice pretty json
Austin Jess
@ajess33
Jan 02 2018 18:52
@khaduch @Gersho thanks guys!
CamperBot
@camperbot
Jan 02 2018 18:52
ajess33 sends brownie points to @khaduch and @gersho :sparkles: :thumbsup: :sparkles:
:star2: 3639 | @khaduch |http://www.freecodecamp.org/khaduch
:cookie: 549 | @gersho |http://www.freecodecamp.org/gersho
Bryan Reed
@Bronsky91
Jan 02 2018 19:36

Howdy! I'm using React-Router & I have a <Link/> that I'm using as a logout button. The thing is is that I need the <Link/> to do an onClick to fire off a fetch action to my API. Right now I have to click the Link twice to actually get redirected to where I want to go. The first click fires the onClick action and the second click does both the action again and then finally brings me to the proper page.

<Link to='/' onClick={() => fetchLogout(authStatus.token)}>Log Out</Link>

Any thoughts?

glandon22
@glandon22
Jan 02 2018 19:45
showing more code might help
whats happening in the fetchLogout function?
Bryan Reed
@Bronsky91
Jan 02 2018 19:46
Calling my API to remove the auth token from the database, it's a Redux action
export const fetchLogout = token => {
  headers['token'] = token
  let init = {
    method: 'GET',
    headers
  };
  return function (dispatch) {
    fetch('http://localhost:3000/logout', init)
      .then(response => {
        response.text().then(text => dispatch(logout(text)));
      })
  }
}
glandon22
@glandon22
Jan 02 2018 19:49
strange
have you checked in the console? maybe the network tab could help
Bryan Reed
@Bronsky91
Jan 02 2018 19:50
Network tab is just showing my fetch completing
Like I said it's basically working but it takes 2 clicks to actually get the Link to redirect me, and it ends up doing the fetchLogout action twice
glandon22
@glandon22
Jan 02 2018 19:56
im not that familiar with redux
but one thing that comes to mind is maybe the first click removes the entry from ur db, then the second click fails to find anything to remove then gets to redirect?
just a wild guess
or logs the user out
Bryan Reed
@Bronsky91
Jan 02 2018 20:00
Yeah that's pretty much what is happening
I just need it to redirect AND make the api call at the same time XD
glandon22
@glandon22
Jan 02 2018 20:03
lol
maybe look around in your logic in your api endpoint /logout
Bryan Reed
@Bronsky91
Jan 02 2018 20:04
Weird thing is the second logout API call is just changing the object keys that it returns to 500 error so it's not really returning anything different'
Screen Shot 2018-01-02 at 1.04.37 PM.png
glandon22
@glandon22
Jan 02 2018 20:05
learning react has been a pain especially logins/logouts
Bryan Reed
@Bronsky91
Jan 02 2018 20:05
Screen Shot 2018-01-02 at 1.04.29 PM.png
glandon22
@glandon22
Jan 02 2018 20:06
then after the 500 error youre redirected to your index page?
Bryan Reed
@Bronsky91
Jan 02 2018 20:06
Yeah the second logout action and the redirect happen at the same time finally
Screen Shot 2018-01-02 at 1.07.19 PM.png
Here's what it looks like in the React dev tools
I really think it comes down to this ^ What html is actually being generated by React
There's gotta be something about having an onClick and an href somewhere that I just can't seem to find
was looking at this
is that <a> automatically generated or did you put that in there?
you may remove it and just have the 'log out' text there
Bryan Reed
@Bronsky91
Jan 02 2018 20:13
The <a> is what is inside the <Link/> component
glandon22
@glandon22
Jan 02 2018 20:13
i would try removing that <a> tag
and just leave the text
Bryan Reed
@Bronsky91
Jan 02 2018 20:14
The <Link> is the anchor so I can remove it, also this stack doesn't have an onClick so it's not quite what I need :/ thanks tho
glandon22
@glandon22
Jan 02 2018 20:14
hmmm
sorry man
good luck
Bryan Reed
@Bronsky91
Jan 02 2018 20:14
Haha thx
Think I'm gonna move on from it for now and come back, spent too much time on something so small lol
glandon22
@glandon22
Jan 02 2018 20:15
lol happens, react is confusing
Sorin Ruse
@sorinr
Jan 02 2018 20:20
@Bronsky91 js events on html looks nice sometime but as you can't maintain same consistency all over one site i would go for all js in a separate javascript file. using it as in the example above will force me to make the code limited to that <Link> scope and not be able to reuse the code
Bryan Reed
@Bronsky91
Jan 02 2018 20:25
I'm using React/Redux and the above is JSX. I'm confused to what you mean
Sorin Ruse
@sorinr
Jan 02 2018 20:26
@Bronsky91 i mean in writing reusable components be them react/vue/watever
BrianWilliams28
@BrianWilliams28
Jan 02 2018 20:26
hey guys, I'm working on the symmetric difference advanced algorithm and I'm a little stuck on how to do it. Trying to figure out a way to get the difference between the first two argument arrays for now. any tips are appreciated.
function sym(args) {
  var args = Array.prototype.slice.call(arguments);
  let flattened = args.reduce((a, b) => a.concat(b));
  let sort = flattened.sort();
  let diff = [];






return args;
}

sym([1, 2, 3], [5, 2, 1, 4]);
shrmn
@shrmn
Jan 02 2018 20:31
Hey, all. I just started FCC yesterday. I'm on the first project, the tribute page. And I can't tell why my UL text is displaying so much smaller than the rest of the text. https://codepen.io/dvshrmn/full/zpzmGg/
glandon22
@glandon22
Jan 02 2018 20:33
@shrmn its probably just the default <ul> styling. you can just add your own class and override the default with whatever size text you want
shrmn
@shrmn
Jan 02 2018 20:34
Ah, thank you.
Sorin Ruse
@sorinr
Jan 02 2018 20:36

@shrmn you can play with:

ul li{
  font-size: 1.5em;
}

where you can increase or decrease the ems

Henry
@GitHub-Henry
Jan 02 2018 20:38
@shrmn does your tribute meet user story requirement?
User Story: I can click on a link that will take me
to an external website with further information on the topic.
overall nicely done
:shipit: :sparkles:
glandon22
@glandon22
Jan 02 2018 20:39
yep its much cleaner than my first tribute page hahaha
nice job
shrmn
@shrmn
Jan 02 2018 20:40
Thanks!
shrmn
@shrmn
Jan 02 2018 20:45
I'm probably trying too hard to make it look similar to the example page.
glandon22
@glandon22
Jan 02 2018 20:49
its alright for your first project
try to add some creative touches as u get more comfortable
Ben Line
@Benwebdev
Jan 02 2018 21:07
Evening FCC :smile:
glandon22
@glandon22
Jan 02 2018 21:15
hows it goin man
Ben Line
@Benwebdev
Jan 02 2018 21:15
I'm great :D.
Anyone need any support with frontend, let me know :D.
Tiago Correia
@tiagocorreiaalmeida
Jan 02 2018 21:16
hey
Ben Line
@Benwebdev
Jan 02 2018 21:16
hey @tiagocorreiaalmeida
shrmn
@shrmn
Jan 02 2018 21:20
@GitHub-Henry It does now. I was still working on it earlier.
Thanks for looking at it.
I've fulfilled the requirements, I think. So I am going to move onto the next challenge. Except, maybe tomorrow because wow I spent 4+ hours working on this.
A_A
@Otto-AA
Jan 02 2018 21:22
@shrmn It's because Bootstrap increases the fontsize of paragraphs inside a jumbotron:
.jumbotron p {
    margin-bottom: 15px;
    font-size: 21px;
    font-weight: 200;
}
shrmn
@shrmn
Jan 02 2018 21:34
Ah. Thank you.
Marc
@MWBauer
Jan 02 2018 21:41
Hey everyone!
How we doing today?
Tiago Correia
@tiagocorreiaalmeida
Jan 02 2018 21:41
hey
@MWBauer
Marc
@MWBauer
Jan 02 2018 21:41
:wave: @tiagocorreiaalmeida
I'm trying to use FONT Awesome with a search icon and it isn't working. I've looked at examples and played around myself....and it just won't.
Gimme a hand?
```<a class="btn btn-default">
<i class="fa fa-search"></i>
Click me</i></a>
Tiago Correia
@tiagocorreiaalmeida
Jan 02 2018 21:42
so is there a codepen for this ':D
?
Marc
@MWBauer
Jan 02 2018 21:42
<a class="btn btn-default">
      <i class="fa fa-search"></i>
      Click me</i></a>
glandon22
@glandon22
Jan 02 2018 21:42
you have the CDN link in your document head?
Marc
@MWBauer
Jan 02 2018 21:42
Sure
The what?
Tiago Correia
@tiagocorreiaalmeida
Jan 02 2018 21:42
that was my first tought but I prefer to see the code it self
the cdn
or the css files
Tiago Correia
@tiagocorreiaalmeida
Jan 02 2018 21:43
of the font
glandon22
@glandon22
Jan 02 2018 21:43
ya man
Tiago Correia
@tiagocorreiaalmeida
Jan 02 2018 21:43
you are missing
the cdn
glandon22
@glandon22
Jan 02 2018 21:43
looks like you need to add a link to the font awesome stuff
Tiago Correia
@tiagocorreiaalmeida
Jan 02 2018 21:43
cdn is a link that gives you the access to the named icons
Marc
@MWBauer
Jan 02 2018 21:43
oh....
and whta would that look like?
Tiago Correia
@tiagocorreiaalmeida
Jan 02 2018 21:44
its the same as you importing bootstrap
to there
sec
Marc
@MWBauer
Jan 02 2018 21:45
I got it
And just immediatel it popped up.
glandon22
@glandon22
Jan 02 2018 21:45
sweet
Marc
@MWBauer
Jan 02 2018 21:47
working on my button.
Henry
@GitHub-Henry
Jan 02 2018 22:00
@shrmn yes, the links completes it, good job
:shipit: :dizzy:
David Belmares
@DavidBelmares
Jan 02 2018 23:27
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  var output = arr;
  for (i = 0; i < output.length; i++){
    if (output[i] == false || output[i] == null || output[i] == 0 || output[i] == "" || output[i] == undefined || output[i].isNaN){
      output.splice(i);
    }
  }
  return output;
}

bouncer([7, "ate", "", false, 9]);
I am completely confused as to why this code doesn't work. It's supposed to remove all falsy values from an input array, but according to FCC it doesn't
image.png
Gersho
@Gersho
Jan 02 2018 23:33
if you remove a value from the array, the next itteration of your for loop will not point to the value you want
try checking the filter() function @DavidBelmares
David Belmares
@DavidBelmares
Jan 02 2018 23:39
I tried using the filter function but it didn't work for me. I'll try making the iteration value go down 1 when it splices something
never mind that doesn't seem to work either
Gersho
@Gersho
Jan 02 2018 23:40
do as you wish, since it's important to write code that makes sense to you, but you'll have to learn to use filter at some point
similar comment applicable to reduce
David Belmares
@DavidBelmares
Jan 02 2018 23:42

hmm following the filter example on the mozilla dev website... this won't work either
function bouncer(arr) {
return arr.filter(arr != false);
}

bouncer([7, "ate", "", false, 9]);

Gersho
@Gersho
Jan 02 2018 23:43
sorry i drank a bit too much to get technical ^^but good luck
try w3schools
David Belmares
@DavidBelmares
Jan 02 2018 23:43
alright
Rachel
@rachelasawyer
Jan 02 2018 23:45
I'm stuck on the Wikipedia Viewer challenge. My console.log() says I'm getting a CORS error, but I'm not quite sure how to fix it . Do I even have my API set up correctly? Any guidance would be greatly appreciated! https://codepen.io/rachelsawyer/pen/Kvdjzj?editors=1010
iso
@iso1048
Jan 02 2018 23:45

@DavidBelmares your syntax for the filter function looks off.

arr.filter(function(currentArrElement){
  return currentArrElement != false;
});

or in E6

arr.filter(current => current != false);

I think...

@DavidBelmares as you have done, you want to return the filter function
Ben Line
@Benwebdev
Jan 02 2018 23:46
@rachelasawyer looking for you
David Belmares
@DavidBelmares
Jan 02 2018 23:47
function nonFalsy(value){
  return value != false;
}
function bouncer(arr) {
  return arr.filter(nonFalsy);
}
i've tried this but not working either
following after the w3schools example
David Belmares
@DavidBelmares
Jan 02 2018 23:48
@tiagocorreiaalmeida thanks but I already tried that example
CamperBot
@camperbot
Jan 02 2018 23:48
davidbelmares sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 484 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Jan 02 2018 23:48
oh ok
nm didnt even readed the code
give me a sec
Ben Line
@Benwebdev
Jan 02 2018 23:50
@rachelasawyer it's because your fetch random...
Gersho
@Gersho
Jan 02 2018 23:50
try console.log(arr.filter(nonFalsy)) to see what goes wrong
Tiago Correia
@tiagocorreiaalmeida
Jan 02 2018 23:51


function nonFalsy(value){
  return value !== false;
}
function bouncer(arr) {
  return arr.filter(nonFalsy);
}

let arr = ["1",false];

console.log(bouncer(arr));
David Belmares
@DavidBelmares
Jan 02 2018 23:53
let? never seen that before... hmm
Gersho
@Gersho
Jan 02 2018 23:53
was thinking
function nonFalsy(value){
  return value != false;
}
function bouncer(arr) {
//console log here
  return arr.filter(nonFalsy);
}
David Belmares
@DavidBelmares
Jan 02 2018 23:53
that's exactly what I did
Gersho
@Gersho
Jan 02 2018 23:54
let is like var but scope is different, don't worry too much about it for now
David Belmares
@DavidBelmares
Jan 02 2018 23:54
oh ok
Gersho
@Gersho
Jan 02 2018 23:54
and what the console log says ? (for the values that don't work in the challenge)
function nonFalsy(value){
  return value != false;
}
function bouncer(arr) {
//console log here
console.log("value tested:"+arr);
console.log("result:"+arr.filter(nonFalsy));
  return arr.filter(nonFalsy);
}
David Belmares
@DavidBelmares
Jan 02 2018 23:56
maybe i'll have to explicitly say that the value cannot be undefined, null, etc
Gersho
@Gersho
Jan 02 2018 23:57
that is what i did on mine
David Belmares
@DavidBelmares
Jan 02 2018 23:57
nope...
function nonFalsy(value){
  return value != false && value != null && value != 0 && value != "" && value != undefined && value != isNaN;
}
function bouncer(arr) {

  return arr.filter(nonFalsy);
}

bouncer([false, null, 0, NaN, undefined, ""]);
kerafyrm02
@kerafyrm02
Jan 02 2018 23:58
There's an easier way than that David
iso
@iso1048
Jan 02 2018 23:58

@rachelasawyer you could just do this:

function newRandomArticle() {  
  window.open('https://en.wikipedia.org/wiki/Special:Random');
}

?

Gersho
@Gersho
Jan 02 2018 23:59
an href with # target should suffice, no need to js that
kerafyrm02
@kerafyrm02
Jan 02 2018 23:59
function bouncer(arr){
    return arr.filter(function(val){ return val; });
}
^^ easier
iso
@iso1048
Jan 02 2018 23:59
yeah, or what @Gersho says