These are chat archives for FreeCodeCamp/HelpJavaScript

17th
May 2018
Angela Sirls
@annDAcoder_gitlab
May 17 2018 00:00

Back to square ONE (NOTE: Case the same):
var firstName = "Alan";
var lastName = "Turing";

// Only change code below this line
var myfirstName = "Angela";
var mylastName = "Sirls";

Joseph
@revisualize
May 17 2018 00:00
@annDAcoder_gitlab again.
F and L
vs
f and l
Angela Sirls
@annDAcoder_gitlab
May 17 2018 00:01
OMG!!!!!
That's the issue.
Joseph
@revisualize
May 17 2018 00:01
Yes.
Angela Sirls
@annDAcoder_gitlab
May 17 2018 00:01
Thanks to everyone!!!
Joseph
@revisualize
May 17 2018 00:01
That's what we've all been saying.
Brad
@bradtaniguchi
May 17 2018 00:02
The most important thing to learn as a dev is to name things, the second is to spell things right. Typos = death
Angela Sirls
@annDAcoder_gitlab
May 17 2018 00:02
F and L vs f and l
Kudzu
@czhower
May 17 2018 00:07
espcially in a lang like JS which doesnt verify anything even at runtime... this is why linters are a must, but codepen etc doesnt support linters.
Bjorn van de Peut
@bjorno43
May 17 2018 00:45
@annDAcoder_gitlab It was a joke I made. You weren't supposed to actually use it, haha
Angela Sirls
@annDAcoder_gitlab
May 17 2018 01:20
May I ask what are linters?
I'm sorry. I'm NEW at this.
Dhaval Vira
@dhavalveera
May 17 2018 01:23
Yes, ask
@annDAcoder_gitlab
Brad
@bradtaniguchi
May 17 2018 01:33
TLDR: its a a program that run in the background while you code and tells you of errors/issues with the code. Think of like spell check, but for code
Angela Sirls
@annDAcoder_gitlab
May 17 2018 01:44
Oh ok. Thanks.
Brad
@bradtaniguchi
May 17 2018 01:49
np :D
Kudzu
@czhower
May 17 2018 01:52
Since JS isnt compiled and very very loose with its grammar allowing many simple typos to become bugs rather than flat out errors, linters help verify and vet your code to identify problems.
Kudzu
@czhower
May 17 2018 02:13
Think of a linter like an audit.
Cici Cao
@cici822
May 17 2018 03:50
var myStr= "\"\ \t \b \r \f\""; wrong???
Henry
@GitHub-Henry
May 17 2018 03:50
@cici822 https://regexr.com/ a good regex tool
Brad
@bradtaniguchi
May 17 2018 04:01
That doesn't look like a valid regex, no need for quotes and you need something like:
const myRegex = \/*put your stuff here*/\g
Or use the new Regex(/*your string*/);
Rohit Yadav
@rohyadav
May 17 2018 04:14
hi
anyone help me out some Regex matching
case failure
Angela Sirls
@annDAcoder_gitlab
May 17 2018 04:25
@cici822 try this var myStr = "\ \t \t \r \n";
Rohit Yadav
@rohyadav
May 17 2018 04:28
01.png
@annDAcoder_gitlab
its matching DS
even in this case if only DS have left right space and it should be highlighted right
Danny Chan
@chandanny
May 17 2018 04:32
do anyone have a good tutorial to learn SEO?
Dhaval Vira
@dhavalveera
May 17 2018 04:32
Yes @chandanny
Danny Chan
@chandanny
May 17 2018 04:32
@dhavalveera can you share it?
@chandanny
Joseph
@revisualize
May 17 2018 04:34
hi
Dhaval Vira
@dhavalveera
May 17 2018 04:34
hi
Rohit Yadav
@rohyadav
May 17 2018 04:36
@NJM8
Norvin Burrus
@ndburrus
May 17 2018 04:51
Angela Sirls
@annDAcoder_gitlab
May 17 2018 05:10
Thanks @ndburrus I going through the challenges for Dev so I guess I wont need linters until I'm actually working in the environment(?). Right?
CamperBot
@camperbot
May 17 2018 05:10
anndacoder_gitlab sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 2221 | @ndburrus |http://www.freecodecamp.org/ndburrus
Norvin Burrus
@ndburrus
May 17 2018 05:11
@annDAcoder_gitlab ...it's your call. :smile: you don't have to use one...
Danny Chan
@chandanny
May 17 2018 06:00
@dhavalveera @ndburrus thank you
CamperBot
@camperbot
May 17 2018 06:00
chandanny sends brownie points to @dhavalveera and @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 2222 | @ndburrus |http://www.freecodecamp.org/ndburrus
:cookie: 121 | @dhavalveera |http://www.freecodecamp.org/dhavalveera
Norvin Burrus
@ndburrus
May 17 2018 06:03
@chandanny you're welcome! enjoy :palm_tree:
Danny Chan
@chandanny
May 17 2018 06:05
do you think SEO is so matter for web developer?
@ndburrus i guess it is so important for web development
Norvin Burrus
@ndburrus
May 17 2018 06:09
@chandanny i think it's important, but not among the initial highest priorities... :leaves:
Danny Chan
@chandanny
May 17 2018 06:12
@ndburrus same to me. every web needs SEO but the information architecture and software design are much more important
Cici Cao
@cici822
May 17 2018 06:14
@annDAcoder_gitlab var myStr= "\ \t \b \r \n"; thank you~
CamperBot
@camperbot
May 17 2018 06:14
cici822 sends brownie points to @anndacoder_gitlab :sparkles: :thumbsup: :sparkles:
api offline
Norvin Burrus
@ndburrus
May 17 2018 06:20
@chandanny agreed :star:
Dhaval Vira
@dhavalveera
May 17 2018 06:29
@chandanny SEO is required to Increase the Page Rank on Search Engine
so you will get more Traffic on your Website
@dhavalveera that type of SEO
Dhaval Vira
@dhavalveera
May 17 2018 07:22
do you know the use of SEO ? @chandanny
Danny Chan
@chandanny
May 17 2018 07:34
@dhavalveera not sure
Dhaval Vira
@dhavalveera
May 17 2018 07:35
SEO stands of Search Engine Optimization
SEO is used for Search Engine
means if your SEO is strong in Website then you will get higher page rank of Search Engine
Danny Chan
@chandanny
May 17 2018 07:36
@dhavalveera i see.
Dhaval Vira
@dhavalveera
May 17 2018 07:36
Yes
@chandanny text me directly
Marianissimus
@Marianissimus
May 17 2018 07:43
So many people try to outsmart Google, and they all fail. SEO helps, but content is what really matters. Google has always been looking for relevant content, and they will continously improve their search algorithm to find it. Bottom line: if you have good quality content, Google will raise your search position. If you only have SEO and no content, Google will get you down.
Dhaval Vira
@dhavalveera
May 17 2018 07:44
sir it never depend on content
you may learn that SEO is also matter to Meta keywords
Marianissimus
@Marianissimus
May 17 2018 07:44
IT IS ONLY ABOUT CONTENT
this is why you use Google
to find relevant information
Dhaval Vira
@dhavalveera
May 17 2018 07:44
whenever you search anything on Google it will show results from Meta Keywords what you have entered
who said this
Marianissimus
@Marianissimus
May 17 2018 07:44
content FIRST
Google said this
Dhaval Vira
@dhavalveera
May 17 2018 07:45
Google never say this
Google say that it is depend on Meta Keywords & then content
whenever whatever you search first it search from meta Keywords & then content
Marianissimus
@Marianissimus
May 17 2018 07:45
NO, you misunderstand
Dhaval Vira
@dhavalveera
May 17 2018 07:45
if there is no keyword is there in meta tag & that is avail in content then it will show result as per content
I am not miunderstand
you are misunderstand
I have learn this
Marianissimus
@Marianissimus
May 17 2018 07:46
I said seo is good, but content is king
update your learning
Dhaval Vira
@dhavalveera
May 17 2018 07:46
I have learned few days back, you have learn years ago
Marianissimus
@Marianissimus
May 17 2018 07:46
Why do we use Google to find things????
Dhaval Vira
@dhavalveera
May 17 2018 07:46
you need to update your learning
Marianissimus
@Marianissimus
May 17 2018 07:46
Ask yourself this: why do we use GOOGLE
Dhaval Vira
@dhavalveera
May 17 2018 07:46
go & ask google that how they are show searched
search results
I am updated on this
Marianissimus
@Marianissimus
May 17 2018 07:47
why do we use google?
Dhaval Vira
@dhavalveera
May 17 2018 07:47
and I got to know this from SEO Specialist
to search what we need
Marianissimus
@Marianissimus
May 17 2018 07:47
Ok, keep up with the bs work
Dhaval Vira
@dhavalveera
May 17 2018 07:47
and it is not depend on Content
Marianissimus
@Marianissimus
May 17 2018 07:47
of course it is
Dhaval Vira
@dhavalveera
May 17 2018 07:47
don't make yourself right
you are out dated
go and update your self
revise your knowledge
Marianissimus
@Marianissimus
May 17 2018 07:48
What is Google?
Is it a search engine?
Dhaval Vira
@dhavalveera
May 17 2018 07:48
your head
go and update your knowledge
SEO never use Content only
they use Keyword
if SEO works on Content then why people Update their Meta Keyword
Marianissimus
@Marianissimus
May 17 2018 07:48
You don't understand the web, my friend
Dhaval Vira
@dhavalveera
May 17 2018 07:48
you are out dated sir
if SEO works on Content then why people Update their Meta Keyword
if SEO works on Content then why people Update their Meta Keyword
Marianissimus
@Marianissimus
May 17 2018 07:49
SEO WORKS ON CONTENT
Dhaval Vira
@dhavalveera
May 17 2018 07:49
why SEO Specialist says that SEO need meta keywords
Sir don't do irrelevant argument with out dated knowledge
Marianissimus
@Marianissimus
May 17 2018 07:49
YES, it needs, but CONTENT > SEO
Dhaval Vira
@dhavalveera
May 17 2018 07:49
go and ask google & also ask SEO Specialist
you are just doing irrelevant argument
Marianissimus
@Marianissimus
May 17 2018 07:49
If only SEO mattered, there would be no relevant search results
Google provides search results
Dhaval Vira
@dhavalveera
May 17 2018 07:49
you are trying to show that you have only knowledge
we dont have brain
search result never depend on Content & it depend on Content then why big top Companies upate their Meta Keywords for SEO
Marianissimus
@Marianissimus
May 17 2018 07:50
/ban @dhavalveera
Dhaval Vira
@dhavalveera
May 17 2018 07:50
thanks
because you don't have guts to Accept the Truth & Reality
you are just showing yourself Genuies
@Marianissimus
Dimitris Nik.
@dimitrissnk
May 17 2018 08:10
Hey there, I need some help with the FCC local weather app! Could somebody help?
abraham anak agung
@padunk
May 17 2018 08:46
@Dimitrios51 just post your question here, someone will help
Abhiinfo
@Abhiinfo
May 17 2018 08:49
Hello,can anyone suggest me...I want to put condition as 9 am till 6 pm and 6pm till 3 am ....how should I compare these timings
I have taken the timing as AM PM format and below is the calculation
var hours = d.getHours();
var minutes = d.getMinutes();
var ampm = hours >= 12 ? 'pm' : 'am';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
abraham anak agung
@padunk
May 17 2018 09:07
@Abhiinfo take your var hours to compare?
Blauelf
@Blauelf
May 17 2018 09:13
Before you destruct them in hours %= 12;
I'd be more like var strTime = `${(hours + 11) % 12 + 1}:${('0' + minutes).slice(-2)} ${hours < 12 ? 'am' : 'pm'}`;, not destroying my original values. Unless you don't need them any more of course.
abraham anak agung
@padunk
May 17 2018 09:44
How to display time according to user timezone ? say i have this time 2018-06-14T18:00:00.000Z. Do JS automatically know about user timezone?
Stephen James
@sjames1958gm
May 17 2018 09:47
@padunk Your browser has access to the time zone supplying it to the js engine
new Date()
Thu May 17 2018 04:47:05 GMT-0500 (Central Daylight Time)
abraham anak agung
@padunk
May 17 2018 09:51
@sjames1958gm yes, i mean if i have this time 2018-06-14T18:00:00.000Z and put it on an app, will it show according to user timezone?
Bjorn van de Peut
@bjorno43
May 17 2018 10:27
@padunk I didn't mess enough with dates / times in JS to be sure. But keep in mind that JS is client side. There's no server involved. So all it can rely on is the time provided locally. Unless some server is provided where it fetches the time.
abraham anak agung
@padunk
May 17 2018 10:30
@bjorno43 @sjames1958gm I think i got it. Thanks :+1:
CamperBot
@camperbot
May 17 2018 10:30
padunk sends brownie points to @bjorno43 and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 288 | @bjorno43 |http://www.freecodecamp.org/bjorno43
:star2: 9246 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Donnie
@Donnie-D
May 17 2018 11:02
function a(b){
  b(c);
}
function b(3){
  return 3;
}
a(b);
why wont it work?
abraham anak agung
@padunk
May 17 2018 11:04
@Donnie-D you can't have number as your parameter name. it will return error.
and where is c came from?
Donnie
@Donnie-D
May 17 2018 11:06
@padunk c is the argument/placeholder for 3. so what is the correct syntax here?
obviously i am wrong. i want to know where :smile:
abraham anak agung
@padunk
May 17 2018 11:07
@Donnie-D remove c in a function and change 3 to c in b function and don't forget to return
function a(b){
  return b();
}
function b(){
  return 3;
}
a(b);
Donnie
@Donnie-D
May 17 2018 11:12
do we have to type in return if we are calling a function in here?
function a(b){
  return b(); //here
}
abraham anak agung
@padunk
May 17 2018 11:15
@Donnie-D you should try it at https://repl.it/ it has some cool feat for JS :smile: and yes you have to return it if you want a to produce something or it will get undefined
Donnie
@Donnie-D
May 17 2018 11:16
@padunk yes :smile: i am on repl.it playing with this. i have seen functions being called without return being written before them. I wonder what am i missing here
abraham anak agung
@padunk
May 17 2018 11:17
@Donnie-D idk, arrrow functions? var a = (b) => b();
btw, i have to go, good luck :smile: @Donnie-D
Donnie
@Donnie-D
May 17 2018 11:18
function greeting(name) {
  alert('Hello ' + name);
}

function processUserInput(callback) {
  var name = prompt('Please enter your name.');
  callback(name);
}

processUserInput(greeting);
this is a little example from mdn. here the function is being called inside another function without having to write return before
oh ok thanks though :smile:
Markus Kiili
@Masd925
May 17 2018 11:21
@Donnie-D Adding return makes the function return the value that expression evaluates to (instead of just evaluating it).
Donnie
@Donnie-D
May 17 2018 11:23
@Masd925 so does it mean that we almost always have to add return before calling a function inside another function?
Markus Kiili
@Masd925
May 17 2018 11:25
@Donnie-D No, it depends on the logic you are using. You use return if you wan't the function to return the value (a return value from another function is this case).
Functions can call other functions without using return.
Donnie
@Donnie-D
May 17 2018 11:32
function a(b){
  b(c);
}
function b(3){
  return 3;
}
a(b);
in above case I know there is some mistake ( probably on line 4) which is why I get an error but in function b i am returning 3. So in this case if there wasnt a problem on line 4 then I dont have to add return when calling function b in function a. Am I correct? and by the way what is the mistake in my logic in the code above please @Masd925
Markus Kiili
@Masd925
May 17 2018 11:32
@Donnie-D Function parameter needs to some identifier, not 3 like here. Here you don't need a parameter on function b, I think.
It is a placeholder for the argument from the function call.
Also c is not defined anywhere
Markus Kiili
@Masd925
May 17 2018 11:38
@Donnie-D
function a(b){
  b();   // evaluates to 3, but doesn't do anything
}
function b(){
  return 3;
}
a(b);
Donnie
@Donnie-D
May 17 2018 11:39
function a(b){
  b(c);
}
function b(c){
  c=3;
  return c;
}
a(b);
now I initiated c and made a correction on line 4 but I am still getting some logic wrong here.
Markus Kiili
@Masd925
May 17 2018 11:39
b is used as a function name and as a parameter, which is a bit confusing (but not wrong).
Donnie
@Donnie-D
May 17 2018 11:39
oops! just pressed enter before saw your code :smile:
@Masd925 yup! your code makes sense :+1:
Donnie
@Donnie-D
May 17 2018 11:46

@Masd925 can you run down my code with me for a second please; stepwise, I want to see the JS logic here to understand where I am getting it wrong in my code.

function a(b){
  b(c);
}
function b(c){
  c=3;
  return c;
}
a(b);

this one :arrow_heading_up:

I declared a function a and passed it an argument b. I used b as a function and passed it another argument c. And I called b inside a.
Then I gave c a value. In the end I called function a
Markus Kiili
@Masd925
May 17 2018 11:50
function a(b){ // This function stores the passed argument on parameter b
  b(c);  // This line calls the passed function with argument evalueted from variable c which is not defined in this scope
}
function b(c){
  c=3;
  return c;
}
a(b); You call the first declared function and pass the second function as an argument
Stephen James
@sjames1958gm
May 17 2018 12:19
@Donnie-D If you start from inside of function a you see c referenced but not defined in a
moving outside of a there is no definition of c available to a (a cannot look inside of b)
sabahatullah
@sabahatullah
May 17 2018 12:51
I want to hide a list item if it contains the following keywords.
  • Turkey,
  • USA,
  • Canada
    basically if the list item doesn't contain Turkey then look for USA, if that doesn't exist either then look for CANADA. If it finds Turkey first then no need to do anything with USA and canada and so on. hope that makes sense?
    I can do that with couple of if conditions but I am looking for some efficient/advanced way. I hope someone can help me out?
Stephen James
@sjames1958gm
May 17 2018 12:57
@sabahatullah /Turkey|USA|Canada/ use regex?
@sabahatullah
/Turkey|USA|Canada/ig.test("this is the USA")
true
sabahatullah
@sabahatullah
May 17 2018 13:03
@sjames1958gm could you tell me how would I create a function to check if any of these keyword one by one in the list items
Stephen James
@sjames1958gm
May 17 2018 13:04
@sabahatullah How is your list stored?
   list.forEach(listItem => {
     if (!(/Turkey|USA|Canada/ig.test(listItem))) {
        // do what you need with listItem
    }
})
sabahatullah
@sabahatullah
May 17 2018 13:08
its an array var country = ['Turkey','USA','Canada']
h1tag
@h1tag
May 17 2018 13:21
@sabahatullah I don't think you can do better than conditions, maybe a switch statement matches what you want to do more
Bjorn van de Peut
@bjorno43
May 17 2018 13:35
@sabahatullah What exactly are you trying to do? Are you trying to see if a string contains one of the countries? Or are you trying to check if an array contains one of the countries?
sabahatullah
@sabahatullah
May 17 2018 13:38
@bjorno43 basically out of ten list items if any Li contains any of the country text I need to hide that. but if for example Turkey exists in any of the list item text. I don't want to hide other mentioned countries. Other countries would only checked if the former country doesn't exist
Stephen James
@sjames1958gm
May 17 2018 13:39
@sabahatullah The code above does that you just have to fill in the hide code because the if selects only those that don't have the three countries
Bjorn van de Peut
@bjorno43
May 17 2018 13:43
@sabahatullah What I'm still not clear about is what exactly it is that you are trying to hide. Do you want to hide the entire list or only the <li> that contains the country name?
You know what? Give us an example list. So we know what it looks like
sabahatullah
@sabahatullah
May 17 2018 13:58
@bjorno43 only the li that contains that country
       <ul class="country">
               <li value="4">Afghanistan</li>
               <li value="8">Albania</li>
               <li value="12">Algeria</li>
               <li value="16">American Samoa</li>
               <li value="20">Andorra</li>
               <li value="24">Angola</li>
               <li value="26">Turkey</li>
               <li value="29">USA</li>

           </ul>
like in the above list it will only hide Turkey.
if there was no turkey then it will hide USA
@sjames1958gm I am trying to apply that code. not sure I got it right.
Stephen James
@sjames1958gm
May 17 2018 14:02
@sabahatullah Ah, I misunderstood your question.
@sabahatullah So if there is Turkey, then you don't hide the USA?
Bjorn van de Peut
@bjorno43
May 17 2018 14:07
@sjames1958gm That's why I always ask for more information first. The question was just too unclear
Bjorn van de Peut
@bjorno43
May 17 2018 14:23
@sabahatullah I haven't tested it, but I believe something like this should do the trick:
function searchAndHideLi(elements, countries){
    for (const country of countries)
    {
        for (const ele of elements){
            if(ele.innerHTML === country){
                ele.style.display = "none";
                return;
            }
        }
    }
}


const country = ['Turkey','USA','Canada'];
const liElems = document.querySelector('.country').getElementsByTagName("li");

searchAndHideLi(liElems, country);
sabahatullah
@sabahatullah
May 17 2018 14:24
@sjames1958gm yes correct.
@bjorno43 is it not going to hide all of them again.
Bjorn van de Peut
@bjorno43
May 17 2018 14:27
@sabahatullah No. That's where the return part jumps in. As soon as it hides something, it kills the function by returning
sabahatullah
@sabahatullah
May 17 2018 15:02
@bjorno43 many thanks I am going to try that shortly and let uyou know
CamperBot
@camperbot
May 17 2018 15:02
sabahatullah sends brownie points to @bjorno43 :sparkles: :thumbsup: :sparkles:
:cookie: 290 | @bjorno43 |http://www.freecodecamp.org/bjorno43
Jason Luboff
@JLuboff
May 17 2018 15:11
:wave:
should be matched complete words if available not characters
Bjorn van de Peut
@bjorno43
May 17 2018 15:56
@rohyadav Please stop spamming that question in every room
Rohit Yadav
@rohyadav
May 17 2018 15:56
@bjorno43 not spamming these questoins
if you don't find any solution then you should ignore it if you really help me then help me
Bjorn van de Peut
@bjorno43
May 17 2018 15:57
@rohyadav This is the 3rd time I've seen it passing by in 2 seperate rooms now
Blauelf
@Blauelf
May 17 2018 16:01
@rohyadav \b might be your friend. Zero-width word boundary (between \w and \W characters)
Bjorn van de Peut
@bjorno43
May 17 2018 16:03
@Blauelf I've temporarily banned him untill he agrees with our Code of Conduct
Blauelf
@Blauelf
May 17 2018 16:04
Missed that one.
Using an image of Spike Spiegel. That one has so much more style.
Christopher McCormack
@cmccormack
May 17 2018 16:06
:wave:
Gulsvi
@gulsvi
May 17 2018 16:10
@bjorno43 I personally don't like it when people post the same question to every room all at once, but @lydatech has made it clear, :point_up: it is not spam
Christopher McCormack
@cmccormack
May 17 2018 16:12
Can we keep that conversation in DMs or something?
Gulsvi
@gulsvi
May 17 2018 16:13
We could
Christopher McCormack
@cmccormack
May 17 2018 16:13
:clap:
@JLuboff what's up man
Bjorn van de Peut
@bjorno43
May 17 2018 16:14
@gulsvi That's not the only issue, the question was asked in the same rooms earlier as well. Anyway, the user agreed to our CoC so I will unban him
Also, the message on its own wasn't the reason for the ban. It was his reaction to me after my friendly request not to do it
Jason Luboff
@JLuboff
May 17 2018 16:16
@cmccormack Just running through my code and cleaning it up according to ESLint. Starting to get a handle on it! (like how to disable a rule in line when needed)
Christopher McCormack
@cmccormack
May 17 2018 16:17
did you do a --fix globally? it's so exciting to think what you might break!
Jason Luboff
@JLuboff
May 17 2018 16:17
Nahhh... running it per file as I go though
Christopher McCormack
@cmccormack
May 17 2018 16:22

I've been trying to come up with the best way to be able to filter items in an array, like in an options file.
I made this last night:

plugins: [
  new CleanWebpackPlugin(["dist", "build", "public",], { verbose: true, }),
  new CompressionPlugin(),
  new HtmlWebpackPlugin(),
  new MiniCssExtractPlugin(),
  showVisualizer && new Visualizer(),
].filter(_=>_)

And I've seen other people do Array.concat or spread operators to merge an optional array to the config array.

My question is - what should i name the _=>_? :D I was thinking tanky
or is there a cleaner way to do it than using filter even?
Jason Luboff
@JLuboff
May 17 2018 16:23
I have no clue whats going on there :P
Christopher McCormack
@cmccormack
May 17 2018 16:23
just assume it's an array required by a module on load
if I didn't want something, like Visualizer() in this case, I don't think you can use a ternary without doing something to filter the undefined or whatever value
Jason Luboff
@JLuboff
May 17 2018 16:24
Ok.. ok.. so are you saying what should you name the _ in the arrow function?
Christopher McCormack
@cmccormack
May 17 2018 16:24
@JLuboff hah yup
it's only job is to filter falsy values basically
Jason Luboff
@JLuboff
May 17 2018 16:25
ah
I just always go with e lol
but if oyu want to be clearer
Christopher McCormack
@cmccormack
May 17 2018 16:25
well I liked the symmetry of _=>_
looks like a hoverboat or something
Jason Luboff
@JLuboff
May 17 2018 16:25
lol
Christopher McCormack
@cmccormack
May 17 2018 16:26
o=>o motorcycle?
Jason Luboff
@JLuboff
May 17 2018 16:26
Ooooh fun
Christopher McCormack
@cmccormack
May 17 2018 16:27
I'm half joking, really just looking for the cleanest way to filter items in an array like that
Blauelf
@Blauelf
May 17 2018 16:27
Filter falsy values? Reminds me of Falsy Bouncer, and return arr.filter(Boolean); :D
Christopher McCormack
@cmccormack
May 17 2018 16:28
@Blauelf I thought of that too but I don't like Boolean very much, not sure why haha
Blauelf
@Blauelf
May 17 2018 16:28
I understand. It looks weird.
It's more of a coincidence that it works for this (because it's ignoring all arguments but the first)
Christopher McCormack
@cmccormack
May 17 2018 16:29
I also don't like its name. You would think just by reading the name Boolean(false) would be true, at least I would, because false is a boolean
Blauelf
@Blauelf
May 17 2018 16:29
new Boolean(false) is truthy ;D
Christopher McCormack
@cmccormack
May 17 2018 16:29
see that's why I don't like it haha
Blauelf
@Blauelf
May 17 2018 16:30
Boolean with new rarely is what one meant.
Gulsvi
@gulsvi
May 17 2018 16:31
Hate to be boring, but if someone else ends up maintaining that code later, you'd probably want to use plugin => plugin :)
Christopher McCormack
@cmccormack
May 17 2018 16:31
I think everything would be truthy with new in that case right?
@gulsvi are you saying I shouldn't just be cryptic??
Gulsvi
@gulsvi
May 17 2018 16:32
πŸ¦„=>πŸ¦„
that could be cool too
Christopher McCormack
@cmccormack
May 17 2018 16:32
see much more descriptive!
Gulsvi
@gulsvi
May 17 2018 16:32
everyone loves unicorns haha
Jason Luboff
@JLuboff
May 17 2018 16:32
Tabs or Spaces? (apparently airbnb likes spaces)
Christopher McCormack
@cmccormack
May 17 2018 16:33
@JLuboff spaces
Blauelf
@Blauelf
May 17 2018 16:33
@cmccormack Yes, any object is truthy, and new always results in an object. Or at least I don't know how one could make it to return something else.
Jason Luboff
@JLuboff
May 17 2018 16:33
I like tabs! But...looking like I'll be switching to spaces hah
Christopher McCormack
@cmccormack
May 17 2018 16:34
@JLuboff let me tell you why spaces - if you ever have to email something to someone and it uses tabs to align columns, you're going to have a bad day
tabs are never consistent whereas spaces always are
(assuming monospace font)
Blauelf
@Blauelf
May 17 2018 16:35
I like tabs - but let my editor insert spaces. Otherwise indentation depends on the editor. What does a tab equal, 3? 4? 8 spaces?
Christopher McCormack
@cmccormack
May 17 2018 16:35
VS Code is very good with spaces acting like tabs, so much so I never notice which I'm using
Jason Luboff
@JLuboff
May 17 2018 16:35
I'm sure I can tell Atom to use spaces instead of tabs
Christopher McCormack
@cmccormack
May 17 2018 16:36
@Blauelf I think atom sublime and vs code all call out tabs/spaces and the size on the bottom right now
@JLuboff yeah check the bottom right
Jason Luboff
@JLuboff
May 17 2018 16:38
Found it in Editor Settings... Change Tab Type to Soft (spaces)
Annnnd that just made my life easier since then eslint fix will change them
Blauelf
@Blauelf
May 17 2018 16:39
VS Code is built on Electron. That's scary. XSS turns into remote code execution with user's rights.
Christopher McCormack
@cmccormack
May 17 2018 16:39
Sounds like your work is done, go get a martini 🍸
so is Atom
Blauelf
@Blauelf
May 17 2018 16:40
Doesn't make it any better.
Christopher McCormack
@cmccormack
May 17 2018 16:40
just calling it out
that's why users should run as standard users
Blauelf
@Blauelf
May 17 2018 16:41
Wasn't Atom the one where Electron originated?
Jason Luboff
@JLuboff
May 17 2018 16:42
Psh...standard users...
Blauelf
@Blauelf
May 17 2018 16:42
An editor should not allow remote code execution, with any rights.
Christopher McCormack
@cmccormack
May 17 2018 16:42
I wouldn't think so as I dont' remember Atom being around all that long but maybe
@Blauelf neither should a browser but we spend all day in those as well
I'm not sure what vector would be used for a xss vuln, maybe plugins?
Blauelf
@Blauelf
May 17 2018 16:49

Atom Shell got renamed to Electron. https://electronjs.org/blog/electron (so it was there before Atom, but built for Atom)

Vector could be an evil URL, or embedded content directing the integrated NodeJS, and each time all Electron apps would have to update. Guess some are slower in reacting.

Bjorn van de Peut
@bjorno43
May 17 2018 16:50
@cmccormack xss doesn't have a single vector for vulnerabilities. It's just bad server side code not properly handling user provided data
Christopher McCormack
@cmccormack
May 17 2018 16:51
I meant what vector in the electron app
I still think it's a convenience vs security argument and we'll probably always have that back-and-forth
Blauelf
@Blauelf
May 17 2018 16:53
First was a registered protocol handler. The other two I haven't fully understood, but it seems you can run HTML in a less privileged mode.
Christopher McCormack
@cmccormack
May 17 2018 16:53
Nothing says a compiled executable is safe either
Blauelf
@Blauelf
May 17 2018 16:54
Not safe. But having everything in a browser means everything is potential active content.
Christopher McCormack
@cmccormack
May 17 2018 16:54
Totally understand
And I imagine that isn't something Microsoft or Atom ignore
At least I hope not!
Blauelf
@Blauelf
May 17 2018 16:59
I think browser-based GUIs processing foreign content present more attack surface than a native application. Especially when there's only a thin barrier between the foreign content and a NodeJS.
Keggatron
@Keggatron
May 17 2018 17:01
does anyone know how I could get a function like this to work in chrome?
new Date(this.state.year, this.state.month, 1).getDay();
in my IDE console window it returns 2
but NaN in Chrome console
sorry I guess the code would be new Date(this.year, this.month, 1).getDay();
Blauelf
@Blauelf
May 17 2018 17:02
Question is: What is this?
Christopher McCormack
@cmccormack
May 17 2018 17:03
@Keggatron can you log this.year and this.month in the console? It's probably not in scope
Keggatron
@Keggatron
May 17 2018 17:03
it is in scope in my component
Bjorn van de Peut
@bjorno43
May 17 2018 17:03
This is this. Can't be that hard :trollface:
Keggatron
@Keggatron
May 17 2018 17:03
my state has :
Blauelf
@Blauelf
May 17 2018 17:03
Yeah, but in this context, do this.year and this.month exist at all?
Keggatron
@Keggatron
May 17 2018 17:04
this.state = {
      month: monthLabels[new Date().getMonth()],
      year: new Date().getFullYear(),
      displayedMonthDays: daysInMonths[new Date().getMonth()]
    }
sorry monthLabels is an array of all of the month names
Blauelf
@Blauelf
May 17 2018 17:04
So your month is a name, not a 0-based number?
Keggatron
@Keggatron
May 17 2018 17:04
yeah
Blauelf
@Blauelf
May 17 2018 17:05
How do you think Date should handle this?
Keggatron
@Keggatron
May 17 2018 17:05
in my REPL it gives back 2
which is the day index for Tuesday
Blauelf
@Blauelf
May 17 2018 17:08
new Date(2018, 4, 1).getDay() returns 2. new Date(2018, "May", 1).getDay() returns NaN (at least in my Firefox)
Kudzu
@czhower
May 17 2018 17:09
blob
Month is also zero based (nuts but welcome to JS, this kind of stuff is everywhere)
Blauelf
@Blauelf
May 17 2018 17:10
@czhower The problem happens one step before getDay().
Kudzu
@czhower
May 17 2018 17:10
getDay returns a 0 base DAY OF WEEK. Maybe you want day of month or didnt realize its - based?
Keggatron
@Keggatron
May 17 2018 17:10
so how come this.month works in the console but not in my code?
Kudzu
@czhower
May 17 2018 17:10
what dose this.month show? What type of data is it?
Blauelf
@Blauelf
May 17 2018 17:10
Maybe it's not the same this.month? Tried logging it?
Keggatron
@Keggatron
May 17 2018 17:11
NaN
I just logged it
wait wait sorry
Kudzu
@czhower
May 17 2018 17:11
NaN isnt a valid value to pass into new Date() AFAIK
Blauelf
@Blauelf
May 17 2018 17:11
Sh** in, sh** out.
Keggatron
@Keggatron
May 17 2018 17:12
this.month is undefined
Kudzu
@czhower
May 17 2018 17:12
gigo - garbage in, garbage out
Blauelf
@Blauelf
May 17 2018 17:13
German swearing is more feces-centered.
Bjorn van de Peut
@bjorno43
May 17 2018 17:13
new Date(2018, "May", 1) should never work. It's just how the method overloading of the date object works. If more than 1 parameter given, it expects integers, not a combination of ints and strings
Keggatron
@Keggatron
May 17 2018 17:13
Yeah I'm seeing that
I thought I had the same things in my code and console which I didn't
k thanks guys
Bjorn van de Peut
@bjorno43
May 17 2018 17:18
If you try Date.parse("May"); it also returns NaN. Meaning the string date representation is not recognised
Gulsvi
@gulsvi
May 17 2018 17:25
@Keggatron Convert it to a string:
new Date((this.state.year, this.state.month, 1).toString()).getDay();
Dates are really ugly across browsers... there is probably a more reliable way to do this if you show all the code
Blauelf
@Blauelf
May 17 2018 17:28
Dates built with numbers are pretty reliable. Parsing strings... Depends on browser and locale. ISO strings often work well.
The whole thing with month 0-based and day of the month 1-based...
Kudzu
@czhower
May 17 2018 18:00
yeah... well JS was invented last 95 and its years were 2 digits as well... .like noone knew about Y2k in just 4 years....... The whole JS lib is full of garbage like this.
Brad
@bradtaniguchi
May 17 2018 18:16
Does anyone know how much I can get with an amazon "free tier"? Can I get a linux box to deploy to?
Aymen
@AymenAlSalem
May 17 2018 18:55
Hello , I have a very basic question but i couldn't understand the code , why console.log(/^[A-Za-z0-9]$/.test('AA')); will return false? to me it's equal to console.log(/^[A-Za-z0-9].*[A-Za-z0-9]$/.test('AA')); which will return true ! , what exactly i'm asking in the first test ?
Christopher McCormack
@cmccormack
May 17 2018 18:56
@AymenAlSalem you're only looking for a single character in the first test
add a + before the dollar sign in the first test and it should be true
@AymenAlSalem also please post code between pairs of three backticks:
```
code
```
Aymen
@AymenAlSalem
May 17 2018 18:58
thank you so much @cmccormack it's very clear now
CamperBot
@camperbot
May 17 2018 18:58
aymenalsalem sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1456 | @cmccormack |http://www.freecodecamp.org/cmccormack
Christopher McCormack
@cmccormack
May 17 2018 18:58
@AymenAlSalem :thumbsup:
Aymen
@AymenAlSalem
May 17 2018 19:00
so just to be sure , in the first test, i'm looking for 1 char either at the start of the string or at the end of it ?
Christopher McCormack
@cmccormack
May 17 2018 19:00
both
you have it between the start character and end characters
Bjorn van de Peut
@bjorno43
May 17 2018 19:33
@cmccormack Got a funny one for ya:
var user = {
    name: 'Bjorn',
    '&age': 32
}

console.log(user.name); // Bjorn
console.log(user['name']); // Bjorn
console.log(user["name"]); // Bjorn
console.log(user['&age']); // 32
console.log(user["&age"]); // 32
console.log(user.&age); // missing name after . operator
Henry
@GitHub-Henry
May 17 2018 19:34
@AymenAlSalem [A-Za-z0-9]{2} should return true given any combination of 2 letters and numbers
Christopher McCormack
@cmccormack
May 17 2018 19:36
@bjorno43 I guess & isn't a valid character, at least at the start of a property name
Bjorn van de Peut
@bjorno43
May 17 2018 19:37
@cmccormack Nah. The issue here is the dot operator only accepts valid variable names while brackets accept any string given
Christopher McCormack
@cmccormack
May 17 2018 19:38
@bjorno43 that's what I said :) the & at the beginning of the property name probably makes it invalid to use for dot notation
Bjorn van de Peut
@bjorno43
May 17 2018 19:38
Just one of the weird things about JS, haha
Ah, ye you're right
Christopher McCormack
@cmccormack
May 17 2018 19:39
@bjorno43 yeah they're too strict with property names :)
may be a good reason though
Henry
@GitHub-Henry
May 17 2018 19:40
@cmccormack {2,} would be 2 or more
Bjorn van de Peut
@bjorno43
May 17 2018 19:40
Probably. I just sometimes indulge myself with weird javascript quirks, ghehe
Christopher McCormack
@cmccormack
May 17 2018 19:41
@GitHub-Henry thanks, I was mixing up languages I think
CamperBot
@camperbot
May 17 2018 19:41
cmccormack sends brownie points to @github-henry :sparkles: :thumbsup: :sparkles:
:cookie: 552 | @github-henry |http://www.freecodecamp.org/github-henry
Christopher McCormack
@cmccormack
May 17 2018 19:41
or regex implemenations
Henry
@GitHub-Henry
May 17 2018 19:41
np
Christopher McCormack
@cmccormack
May 17 2018 19:42
@bjorno43 as much as dot notation is useful I wonder if they should just standardize on bracket notation. I think that's how python does it
Aymen
@AymenAlSalem
May 17 2018 19:43
@GitHub-Henry thank you
CamperBot
@camperbot
May 17 2018 19:43
aymenalsalem sends brownie points to @github-henry :sparkles: :thumbsup: :sparkles:
:cookie: 553 | @github-henry |http://www.freecodecamp.org/github-henry
Henry
@GitHub-Henry
May 17 2018 19:44
@AymenAlSalem :+1:
Bjorn van de Peut
@bjorno43
May 17 2018 19:44
Ghehe I had a funny regex PHP question earlier today. Given some html string with one or more style="color:rgb(0,0,0)" attributes in it, use PHP to find them, calculate the hex value and replace all occurences with style="color:#000000"
Christopher McCormack
@cmccormack
May 17 2018 19:45
fun so regex and hex math
Bjorn van de Peut
@bjorno43
May 17 2018 19:46
This was my anwer:
$input = 'content<div style="color:rgb(0,0,0);">more content</div><div style="color: rgb(255,255,255);">more content</div>';

$result = preg_replace_callback(
    // Regex that matches "rgb("#,#,#");" and gets the #,#,#
    '/rgb\((.*?)\);/',
    function($matches){
        // Explode the match (0,0,0 for example) into an array
        $colors = explode(',', $matches[1]);
        // Use sprintf for the conversion
        $match = sprintf("#%02x%02x%02x;", $colors[0], $colors[1], $colors[2]);
        return $match;
    },
    $input
);
Tested and working of course :P
Henry
@GitHub-Henry
May 17 2018 19:48
nice work
Christopher McCormack
@cmccormack
May 17 2018 19:48
what does %02x do? Does it force two digits and convert to hex?
I guess 02x
% is php string format symbol I'm guessing?
Most i've done with PHP in the last 10 years was a simple contact form :)
Bjorn van de Peut
@bjorno43
May 17 2018 19:51
The % starts a conversion. The 0 is the padding character and 2 is the minimum of characters the converstion should result in using the padding if nessesary. The x is treated as an integer and presented as a hexadecimal number with lowercase letters
Christopher McCormack
@cmccormack
May 17 2018 19:51
I love solutions that use built in tools, very nice :)
Bjorn van de Peut
@bjorno43
May 17 2018 19:52
Ghehe yup
Jason Luboff
@JLuboff
May 17 2018 19:53
ew...PHP :satisfied:
Bjorn van de Peut
@bjorno43
May 17 2018 19:55
Each his own. I usually react that way when looking at Python code :P
Christopher McCormack
@cmccormack
May 17 2018 19:55
no way Python code is beautiful
PHP: At least it's easier to read than Perl
Kudzu
@czhower
May 17 2018 19:56
Thats not saying much.... thats like saying 26 English letters are easier to learn than 40,000 Chinese ones.
Christopher McCormack
@cmccormack
May 17 2018 19:58
haha
Python is really only difficult to read when people use complicated list comprehensions
Bjorn van de Peut
@bjorno43
May 17 2018 19:58

I mean, c'mon. Just look at the code that was just posted in the Python channel:

from Mock import patch

s3_function = 'upload_to_s3'
return_value = 'your_return_value'
with patch(s3_function, return_value=return_value):
    response = upload_to_s3(data, key)
    assert response.is_ok == True

Nothing that ends variable declaration? No clear body, just some tab chars? Rly?

Christopher McCormack
@cmccormack
May 17 2018 19:58
yeah looks beautiful
I don't use semi colons in JS though so maybe I"m biased
The colon describes the next line should be part of the body
Bjorn van de Peut
@bjorno43
May 17 2018 20:00
I've coded HTML, CSS, JS, PHP, AHK, C++, C# and Java.. not to mention some other members of the .NET family. Can you imagine my disgust?
Christopher McCormack
@cmccormack
May 17 2018 20:01
I've dabbled in all of those as well (except AHK what is that??) and I love Python, maybe give it a chance!
Kudzu
@czhower
May 17 2018 20:01
Ive never used Python, but it looks pretty decent from what I've seen.
Bjorn van de Peut
@bjorno43
May 17 2018 20:02
AHK = Auto HotKey. Used to be some basic macro script that got out of hand enough to become like a fully working programming language lol
Jason Luboff
@JLuboff
May 17 2018 20:02
I've dabbled in.. JS, html, css, C#, powershell... ooo weee
Bjorn van de Peut
@bjorno43
May 17 2018 20:03
What I mean is, they pretty much all use the same kind of syntaxes. When a lang deviates from that too much, you're disgusted
Christopher McCormack
@cmccormack
May 17 2018 20:04
it isn't all that different, they just omit characters that aren't really needed anyway. JS even uses newline characters, semi colons are optional
Bjorn van de Peut
@bjorno43
May 17 2018 20:06
True, but I'm usually the kind of guy that puts multiple declaration on a single line if they belong together one way or another. Like in the example above I would probably do s3_function = 'upload_to_s3' return_value = 'your_return_value' on a single line. Maybe that's perfectly fine in Python, I have no idea. But it'd become confusing as hell very fast
Christopher McCormack
@cmccormack
May 17 2018 20:08
@bjorno43 I don't think any style guide for any language would use that format though :)
Bjorn van de Peut
@bjorno43
May 17 2018 20:09
@cmccormack Maybe not. I'm not trying to convince you guys of the way I view it. I'm very well aware I'm not perfect :P Just saying: Each his own
Christopher McCormack
@cmccormack
May 17 2018 20:10
Also in Python:
s3_function, return_value  = 'upload_to_s3', 'your_return_value'
Bjorn van de Peut
@bjorno43
May 17 2018 20:11
Ye that works in PHP as well
Christopher McCormack
@cmccormack
May 17 2018 20:11
@bjorno43 Sure, I just see so many people knocking on things like Python until they try it then love it. It's like all those curmudgeons that made fun of cell phones or the internet and now you can't pull it away from them
Bjorn van de Peut
@bjorno43
May 17 2018 20:12
@cmccormack That won't happen to me. The biggest issue with me is that I'm a damn autist :P And I can be extremely stubborn when it comes to stuff that deviates from what I'm used to :P
Christopher McCormack
@cmccormack
May 17 2018 20:13
I was kind of the opposite, moving from Python to Javascript I hated the semicolons and even the curly braces
still do!
Bjorn van de Peut
@bjorno43
May 17 2018 20:13
Hell I messed around with websockets in php 5 while NodeJS was right around the corner.. says enough xD
Christopher McCormack
@cmccormack
May 17 2018 20:14
ohh fun
Bjorn van de Peut
@bjorno43
May 17 2018 20:16
Ghehe. The fact that it was doesn't disturb me.. the fact that I was very well aware but refused to listen did :laughing:
Christopher McCormack
@cmccormack
May 17 2018 20:18
Who wants to move away from what they're familiar with right?
Bjorn van de Peut
@bjorno43
May 17 2018 20:19
Exactly, lol
Christopher McCormack
@cmccormack
May 17 2018 20:20
I don't even do web design as a career and I'm already sort of locked into my tools :)
Bjorn van de Peut
@bjorno43
May 17 2018 20:23
Ye. Still, I do agree that knowing your way around more tools usually ends up being benificial one way or the other. Sometimes the tools you have simply aren't the best at the task at hand
Christopher McCormack
@cmccormack
May 17 2018 20:25
Yeah I totally agree. I try to implement something new into each project I do even if I don't particularly want to learn it. Like right now I'm tryign to use Material UI in my React project and I HATE it, but maybe it will be awesome if I just give it a chance
Brad
@bradtaniguchi
May 17 2018 20:26
Aw man no love for material hehe
Bjorn van de Peut
@bjorno43
May 17 2018 20:26
It was the same with me and libraries / frameworks. I used to hate them! And I thought I had the perfect valid reason for it: What if the library or framework becomes deprecated and you're dependent on it? What if a major vulnerability is discovered and not fixed yet, making everyone using it vulnerable?
Christopher McCormack
@cmccormack
May 17 2018 20:26
@bradtaniguchi I usually use materializecss
much easier in many ways
but the theming in Material-UI is intersting so I wanted to try it
but I feel like I'm doing too much work just to get simple things done
but I guess it's always that way when you first start with something
Bjorn van de Peut
@bjorno43
May 17 2018 20:28
Then an old boss of mine told me: What if you develop everything using native code and I somehow lose you? How will anyone be able to pick up where you left of without going through your code for weeks? And that made me think about it..
Christopher McCormack
@cmccormack
May 17 2018 20:29
What do you mean native code in this context?
Bjorn van de Peut
@bjorno43
May 17 2018 20:30
Native as in no libraries or frameworks. Like pure JS, no jQuery or anything like that
Christopher McCormack
@cmccormack
May 17 2018 20:31
got it so like making your own SSL library vs using OpenSSL
which most people would be familiar with
Bjorn van de Peut
@bjorno43
May 17 2018 20:32
Of course frameworks and libraries can only do so much. Any new member of the team would still have to go through your code. But it'd be a whole lot easier if it was written with a library or framework (s)he's already formilliar with than actually having to figure out everything you came up with yourself
Exactly
Christopher McCormack
@cmccormack
May 17 2018 20:33
Plus it comes with the benefit of those libraries usually having great documentation already
Yeah let the real programmers make the hard stuff, I just want to make stuff I find fun using their tools!
Bjorn van de Peut
@bjorno43
May 17 2018 20:34
Precisely! So after that guy asked me those questions, I truely started to understand the importance of libraries and frameworks
Christopher McCormack
@cmccormack
May 17 2018 20:34
Makes a lot of sense
plus think of the cost/time savings!
@bjorno43 do you work as a developer now?
Bjorn van de Peut
@bjorno43
May 17 2018 20:36
And not to mention the security. Yes there's the risk of discovering a vulnerability and everyone using it will be vulnerable. But there's also an entire team and community behind it solving those issues a whole lot faster than you could ever possibly do on your own. And the combined knowledge of all those people makes vulnerabilities a lot less likely to happen
Unfortunetely not. I've been without a job for a while now
Christopher McCormack
@cmccormack
May 17 2018 20:37
@bjorno43 absolutely! convenience vs security is always a tradeoff, and there are hidden factors like how shitty my own code would be in comparison, even if I think I know how it works
what country are you in? Netherlands?
Bjorn van de Peut
@bjorno43
May 17 2018 20:40
I had a great job a few years ago. However, it got into financial trouble. Our government enforced a "contract stop" upon them. Which means they were no longer allowed to extend existing contracts or offer new ones. And I happened to be in my last temporary contract before I would've gotten a permanent one. So I had to go. A year later that company was declared bankrupt
The Netherlands
Christopher McCormack
@cmccormack
May 17 2018 20:41
ouch that hurts when they have that much power
Bjorn van de Peut
@bjorno43
May 17 2018 20:41
Yup. Though looking at it now, I'd have lost the job a year later anyway
Christopher McCormack
@cmccormack
May 17 2018 20:43
I keep hoping more telecommute jobs open up before I even consider changing careers
So many people hiring but never where we are right?
Bjorn van de Peut
@bjorno43
May 17 2018 20:44
Oh I've had plenty of job offerings. Usually ending up around a table with guys telling me they want the best of the best for minimum wage. With the papers I've got, they can't legally enforce the minimum wage on me unless I accept it myself. Which I simply refuse
I mean, I didn't work my ass of only to make the same amount of money a McDonalds employee would make
Christopher McCormack
@cmccormack
May 17 2018 20:46
That's really messed up. Do people actually take those jobs?
Bjorn van de Peut
@bjorno43
May 17 2018 20:48
Ye. Those idiots you'd refer to as "new guys". Still having dreams about being able grow in a company untill they realise that they're just being kicked out after the maximum amount of time allowed for temporary contracts. Which is 2.5 years
Christopher McCormack
@cmccormack
May 17 2018 20:49
so sad
willing to pay tons for outside work but barely willing to pay anything for their own I bet
Bjorn van de Peut
@bjorno43
May 17 2018 20:52
Well yes and no. Yes, because foreigners are a lot cheaper than anyone here in the Netherlands and admittedly also a lot better at the job (usually). Like I always say "No matter how good you are, some Asian is better at it". And I mean that as a compliment :P Because it's the truth!
But also no, because we actually have laws that forces companies to hire a certain amount of people from within the country. If they hire ppl that is of course
I mean, we even have laws that force companies to hire less fortunete ppl. Like ppl with disabilities that are still capable of working, if only at a slower pace
Christopher McCormack
@cmccormack
May 17 2018 20:58
That's why we have to always keep learning I guess, keep ourselves competitive
Brad
@bradtaniguchi
May 17 2018 21:03
Dang thats crazy stuff
Bjorn van de Peut
@bjorno43
May 17 2018 21:08
@bradtaniguchi Sadly that's how the world works. Looking from the honest employee perspective, it's simply harsh and unfair. Looking from the employer perspective, it's simply business. Getting more work done with less costs equals more profits. It's almost hard to blame them
Conor Murphy
@cmurphy580
May 17 2018 21:09
Screen Shot 2018-05-17 at 2.06.49 PM.png
I'm having an issues with my react dependencies. I've tried two different react starter packs, and both have the same issue:
Brad
@bradtaniguchi
May 17 2018 21:10
Yea thats true, I dislike the idea of employee contract sorta stuff tho. That's a little too progressive for me
Conor Murphy
@cmurphy580
May 17 2018 21:10
Anyone have any idea on how to fix this
Brad
@bradtaniguchi
May 17 2018 21:10
If I understand the situation correctly that is
Ive never seen a screen like that, but then that looks like windows. I know npm is cracking down on security and making it all more visibile
Christopher McCormack
@cmccormack
May 17 2018 21:11
@cmurphy580 I think it's just more noticable now, you can probably just proceed
Conor Murphy
@cmurphy580
May 17 2018 21:11
@cmccormack whats with the critical vulnerability
Christopher McCormack
@cmccormack
May 17 2018 21:12
You can visit the More info link it provides and see if you're susceptible to it.
But like @bradtaniguchi said I believe npm is now showing the vulnerabilities more clearly than they used to, I'm seeing several of different severity recently that I would never see before
But many of those don't affect my project and probably don't affect yours
Conor Murphy
@cmurphy580
May 17 2018 21:14
@cmccormack It says there's nothing you can do about it. @bradtaniguchi I'll work around it. Thanks for the help
CamperBot
@camperbot
May 17 2018 21:14
cmurphy580 sends brownie points to @cmccormack and @bradtaniguchi :sparkles: :thumbsup: :sparkles:
:cookie: 482 | @bradtaniguchi |http://www.freecodecamp.org/bradtaniguchi
:star2: 1457 | @cmccormack |http://www.freecodecamp.org/cmccormack
Bjorn van de Peut
@bjorno43
May 17 2018 21:14
Temporary contracts are simply too easily disbanded. "You're good, but you're just not living up to our standards. Goodbye!". And there's nothing you can do about it. Permanent contracts have a lot of employee rights and are extremely hard to get rid off. So unless you're really lucky, they'll just get rid of you while they still can. Sometimes even offering you to come back in half a year so they're legally allowed to give you temporary contracts again, lol
Brad
@bradtaniguchi
May 17 2018 21:15
Hmm I see, sounds like a pretty progressive way todo business with those employee rights. Good if your a permanent contract, but sucks if you aren't
Bjorn van de Peut
@bjorno43
May 17 2018 21:17
The only issue is: No bank here will offer you a mortgage or anything like that unless you have a permanent contract. So basicly, you can "live" of temporary contracts. But you can't make yourself a living out of them
Brad
@bradtaniguchi
May 17 2018 21:18
geez thats even worse
Bjorn van de Peut
@bjorno43
May 17 2018 21:19
Yup. The Netherlands suddenly isn't so interesting to live in huh? lol
Brad
@bradtaniguchi
May 17 2018 21:21
I mean I never thought about it :P
Bjorn van de Peut
@bjorno43
May 17 2018 21:22
When you live in country where the government actually has to enforce companies to hire natives with laws, you know something is wrong :P
Ah well. Enough self pity, lol
Christopher McCormack
@cmccormack
May 17 2018 21:24
haha it's a problem we're all going to be struggling with that's for sure
Angela Sirls
@annDAcoder_gitlab
May 17 2018 21:34
image.png
Bjorn van de Peut
@bjorno43
May 17 2018 21:35
Well, at least I got this going for me..
7305079982.png
Christopher McCormack
@cmccormack
May 17 2018 21:35
dang
Angela Sirls
@annDAcoder_gitlab
May 17 2018 21:35
Can someone tell me why I continue to get one error message: var myStr = 'This is the start.<-- spacing here -->' + 'This is the end.';
image.png
Christopher McCormack
@cmccormack
May 17 2018 21:36
@annDAcoder_gitlab show your code
the top of your image shows the wrong string, are you reassigning?
Angela Sirls
@annDAcoder_gitlab
May 17 2018 21:37
var myStr = 'My name is Angela, ' + 'I concatenate.';
Jason Luboff
@JLuboff
May 17 2018 21:38
@annDAcoder_gitlab You're string value is not correct
Ultimately it should be This is the start. This is the end.
Angela Sirls
@annDAcoder_gitlab
May 17 2018 21:40
oh ok.... let me try that.
Bjorn van de Peut
@bjorno43
May 17 2018 21:42
The end of that string though.. kinda mortifying :laughing:
Angela Sirls
@annDAcoder_gitlab
May 17 2018 21:43
var myStr = 'This is the start. ' + 'This is the end.';
still doesnt work(?).
error message "myStr should have a value of This is the start. This is the end."
Christopher McCormack
@cmccormack
May 17 2018 21:45
@annDAcoder_gitlab show all of your code
are you assigning multiple strings to myStr?
Jason Luboff
@JLuboff
May 17 2018 21:47
@annDAcoder_gitlab You're code works for me. As @cmccormack asked, do you have var myStr more than once? IF so, that will cause an issue
Angela Sirls
@annDAcoder_gitlab
May 17 2018 21:51
image.png

// Example
var ourStr = "I come first. " + "I come second.";

// Only change code below this line
var myStr = 'This is the start. ' + 'This is the end.';

image.png
Jason Luboff
@JLuboff
May 17 2018 21:52
In that screenshot it looks like there are two spaces after start.?
Angela Sirls
@annDAcoder_gitlab
May 17 2018 21:52
error
let me check
Jason Luboff
@JLuboff
May 17 2018 21:52
Eh that might be the editor actually
Angela Sirls
@annDAcoder_gitlab
May 17 2018 21:53
two spaces after START 😁
@JLuboff THANK YOU!!
CamperBot
@camperbot
May 17 2018 21:54
anndacoder_gitlab sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2414 | @jluboff |http://www.freecodecamp.org/jluboff
Jason Luboff
@JLuboff
May 17 2018 21:54
:+1: