## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• Aug 17 09:33
• Jun 20 21:19
@bjorno43 banned @shenerd140
• May 10 09:13
@bjorno43 banned @zhaokunhaoa
• Apr 25 17:12
@mstellaluna banned @cmal
• Apr 01 18:11
thecodingaviator labeled #31179
• Apr 01 18:11
thecodingaviator labeled #31179
• Apr 01 18:09
thecodingaviator commented #31179
• Apr 01 18:09
thecodingaviator labeled #31182
• Apr 01 18:09
thecodingaviator labeled #31182
• Apr 01 18:07
thecodingaviator commented #31182
• Apr 01 18:07
thecodingaviator labeled #31190
• Apr 01 18:07
thecodingaviator labeled #31190
• Apr 01 18:07
thecodingaviator commented #31190
• Apr 01 18:05
thecodingaviator commented #31157
• Apr 01 18:04

thecodingaviator on master

remove A (#31157) (compare)

• Apr 01 18:04
thecodingaviator closed #31157
• Apr 01 18:04
thecodingaviator closed #33788
• Apr 01 18:04
thecodingaviator commented #33788
• Apr 01 18:02
thecodingaviator closed #31059
• Apr 01 18:02
thecodingaviator commented #31059
Dan Couper
@DanCouper
Can be a bit confusing
mitchell369
@mitchell369
but why don't you need to specify that filter should only retain truthy values?
what operator returns only falsy values?
Dan Couper
@DanCouper
The filter function takes an array, and runs a given function on every element in the array. It returns a new array for every element the given function returns true
So like
[1,2,3].filter(value => value > 1) - this returns [2,3] because those are the values greater than one - the function given says return true if the value is greater than 1
And re Boolean
mitchell369
@mitchell369
but merely passing Boolean through the function is sufficient to produce this interpretation... no comparison operators necessary...
Dan Couper
@DanCouper
Boolean(0) returns false, Boolean(1) returns true, Boolean(null) returns false, Boolean("hello") returns true
The Boolean function coerces anything you give it to true or false according to the rules of JS
mitchell369
@mitchell369
Yah I tihnk I get it, it already has a defined set of rules to produce true and false, filter only produces values that are assigned as true
true is already pre-defined in the function
thank you @DanCouper
CamperBot
@camperbot
mitchell369 sends brownie points to @dancouper :sparkles: :thumbsup: :sparkles:
Dan Couper
@DanCouper
There is another aspect to this - the Boolean function is used by JS under the hood for filter anyway - anything you give to filter, JS will try to convert to true or false to make sure that it doesn't blow up, that it always returns something. So you can do
arr.fipt
So
arr.filter(value => value)
i.e. a function that just returns the value you give it
Because
Filter already takes that value and converts it to true or false
mitchell369
@mitchell369
are you saying arr.fipt == arr.filter (value => value) ?
Markus Kiili
@Masd925
@mitchell369 arr.filter (value => value) filters in truthy array elements, the same as arr.filter (Boolean).
Dan Couper
@DanCouper
arr.fipt is me mistyping @mitchell369
mitchell369
@mitchell369
Good afternoon goyim. Can any of you good goys help me work of why my if statement is n't evaluating non-alpha characters in my code?

function rot13(str) { // LBH QVQ VG!
var numStr = str.split("").map(function (char) {

return String.fromCharCode(64 < char < 72 ? char.charCodeAt() % 26 + 65 : char);
});
return numStr;
}

I have passed through values like ' and it wants to assign them the samevalue as "A"
Stephen James
@sjames1958gm
@mitchell369 64 < char < 72 this is not valid syntax
@mitchell369 Well it is not testing what you want.
What you end up with is essentially (64 < char) < 72 which is testing true/false < 72
mitchell369
@mitchell369
@sjames1958gm ok, I can understand that as someone who wasn't completely hopelessin math
Unwana Essien
@afixoftrix

hello there, I have a web pack/ babel problem

module: {
{
test: /\.js$/, loader: 'babel-loader', query: { presets: ['es2015'] } } ] }, Here is the error I am getting: ^CMacBook-Pro:redux-learn Owner$ npm run-script watch

> redux-learn@1.0.0 watch /Users/Owner/Dev/Test Dump/redux-learn
> webpack --watch

Webpack is watching the files…

parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
Hash: e1004b9f03431443d6e6
Version: webpack 3.10.0
Time: 1232ms
Asset     Size  Chunks             Chunk Names
main.bundle.js   3.4 kB       0  [emitted]  main
main.bundle.js.map  2.46 kB       0  [emitted]  main
[0] ./main.js 890 bytes {0} [built] [failed] [1 error]

ERROR in ./main.js
Module build failed: SyntaxError: Unexpected token (20:21)

18 |     switch (action.type) {
19 |         case "CHANGE_NAME": {
> 20 |             state = {...state, name: action.payload};
|                      ^
21 |             break;
22 |         }
23 |         case "CHANGE_AGE": {
Stephen James
@sjames1958gm
@mitchell369 You need 64 < char && char < 72 to have two numeric comparisons
mitchell369
@mitchell369
@sjames1958gm so can I use a colon after the first evalution then see if it is <|> ?
ok, I don't havemuch experience with && but I will give that a go
Stephen James
@sjames1958gm
@mitchell369 Just read && as AND
Unwana Essien
@afixoftrix
I don't understand why it doesn’t understand spread operator.
mitchell369
@mitchell369
@sjames1958gm That completely destroy the output lol
Stephen James
@sjames1958gm
@mitchell369 char.charCodeAt() % 26 + 65 what is this trying to do?
Markus Kiili
@Masd925
@sjames1958gm Spread operator is ES6 (ES2015).
mitchell369
@mitchell369
@sjames1958gm Its evaluating the remainder when I pass it through 26 character alphabet, I found that is the most effective method to produce the A => N conversion and Z => M or w/e it is. Adding the 65 get's you back to the Ascii recognized coding for A-Z
Unwana Essien
@afixoftrix
@mitchell369 Ok I just added babel ‘stage-3’ presets and it worked.
Stephen James
@sjames1958gm
@Masd925 Odd, it appears that for some reason babel doesn't work for objects like above with just es2015 preset
Markus Kiili
@Masd925
@sjames1958gm Compatibility of spread also differs depending on where/how it is used.
Stephen James
@sjames1958gm
@mitchell369 Why is the second number 72? and not 91 (one more than Z
mitchell369
@mitchell369
@sjames1958gm right on, good start... should be 92
Stephen James
@sjames1958gm
@mitchell369 BTW, your 64 < char && char < 72 is comparing the string value char not the char code of char`
mitchell369
@mitchell369
@sjames1958gm That's a good lead, basically what I see it doing is changing all values that fall below that range into 65 and providing me with the output