« first day (2869 days earlier)      last day (2304 days later) » 

16:12
@Luggage also what resolution is your display?
Using a 4K screen is when you realize how bad software development can be.
Any tips for HR interview?
@Jony Did you pass the technical interview yet?
yes
technical interview + homework test
Now they said I have HR interview and then sign stuff
Be a sane person, and think in advance on how you're going to answer "what's your pay expectations?"
Its a company named Codeoasis in Herzelia pituah
you might know
I alreayd know that they offer something between 12-14k shekels
and they took me as a Junior fullstack dev
Usually it's where people fall most of the time in HR interviews ?
16:24
Depends on the job. I haven't interviewed for Juniors in the past few years
But for Senior positions, most fall in the technical interview.
Anyway, my advice doesn't change
Be sane, and think in advance on how to answer about pay expectations.
I suggest you answer above (quite a bit above, but not way too much) what you think you should get, and mention that you're flexible.
Should I admit that I think that I am a junior and I don't really know the pay rates cause it would be my first job?
I don't think so
@Jony Do you have any other offers?
Not anymore, i had like 3 others but everyone look for seniors
besides them
I mean I have 2 years experience with PHP backend, but most offers need fullstack and mostly front end
and I know nothing besides a bit of vuejs and jquery
But the guy that recruited me to that company, told me to tell them 12-14k
I got their offer by a friend's dad who is a CEO of a recruitment company
The special story there, is that they dont have any positions open, just because the recruitment company told them I have big potential and they tested it, they "opened" a new position for me
So that means I have no competition
16:36
@Jony javascript is easy
@YoukouleleY I dont find angular easy to become good enough for a senior level lol
just disable strict mode and you can do whatever you want
thats what most jobs want here
most want angular experience?
@YoukouleleY JavaScript is not easy.
JavaScript is a schizophrenic child with a knife, and you need to be very gentle not to get stabbed.
16:40
@MadaraUchiha :D
yeah I agree ^^
still love it though
Never claimed otherwise
not pedo
madara please don't joke about mental health
these are people
But "easy" is not the term I would use for JavaScript.
People that don't get to choose to have these illnesses
16:42
@William u srs ?
Yes I'm serious. I'm debating on flagging it. Its not like the kid chooses to have the illness.
Look up the nobel peace prize winner. en.wikipedia.org/wiki/John_Forbes_Nash_Jr.
Reinforcing stigma doesn't help anyone.
there are no schizophrenic child though, it appears when adult :p
@YoukouleleY that is based on averages. You can develop a mental illness at any age
@William Very well, you know what I intended to say, how would you have phrased it in a manner that's humorous but not offensive to any particular group?
I'm not sarcastic, I'm asking seriously.
Javascript is wild, still love it though
16:54
3
Q: Javascript Regexp to find multiple spaces in file with specific structure

GHORINGEI am looking for a regular expression that works in the Javascript regexp engine that satisfies the following requirements. I have a file with content structured in the following way (the text within the box): Column 1 Column 2 Column 3 _________________________________...

@Mr_Green Wow.
I'd probably skip the RegExp completely and parse the file the old fashioned way
yeah looks like people ran out of good questions
And smack whomever gave me that ridiculous unparsable format./
@MadaraUchiha just use a "violent child" I guess not as descriptive for sure. Look up the movie a beautiful mind with John Nash. Feeling bad is one thing, but the stigma is well not good.
smack me daddy
16:57
@William That might be offensive and triggering to kids who were abused in school by bullies
^ I should stop playing CS GO
@MadaraUchiha has a point
@MadaraUchiha "an unjustified violent kid" then. People with mental health issues result in no more statistically voilence difference then comparing male to female ratios.
It isn't the schizophrenia that seems to make them violent from the studies.
It is other mental health issues.
You are using a very small sample of people.
what exactly is "an unjustified violent kid"
> However, rates of violence increased dramatically in those with a dual diagnosis [bipolar disorder and schizophrenia]
17:06
@forresthopkinsa From what I have read that implies those with bipolar and schizophrenia and substance abuse disdorder.
@KendallFrey Unjustified means somebody didn't attack you first. Read up on the DSM. Example: If someone in your family dies it is acceptable to go through mood issues because is it justified behavior. If nobody does then you receive a diagnosis of bipolar.
an eye for an eye to quote the bible.
Wait
So you gave me two definitions
which one did you mean
@MadaraUchiha Yikes, I don't think you can lump a group of people together like that.
I think you would have to use their clinical scores
@DavidKamer I'll accept that.
17:09
@KendallFrey one for violence the other for bipolar. 2 different definitions/examples
@MadaraUchiha For instance I read a work by a guy named Peter Welch who is a current software engineer
He went completely insane and remembers much of it, and it was due to acid
I would trust that guy with a knife over most people because he actually knows what it means to lose your mind
Other people don't...
so they might lose their mind for the first time and kill me
Can someone explain this better gyazo.com/3cfa3c8c58a9f9e2c155a52450d73f04
Alright, I think this very fruitful discussion has last long enough.
There is always a first time and someone who has been to the edge can subvert it
isnt var a = b = 5 creates both a and b vars ?..
17:12
Wait
Why not:
let a = new Array(2).fill(5)
No, that's right, actually.
The only thing wrong I saw was the last two lines of code were in the wrong order
Yeah, I was just giving an alternative lol
17:13
@Jony The var only applies to a, because you aren't in strict mode, b will be implicitly defined on the global scope.
but b will be defined as a var in global scope right
@Jony Think of it like this
var a = (b = 5);
It's just short hand for:
so that b = 5 automatically declares var b = 5 in the global scope?
b = 5;
var a = b;
17:15
@Jony Yes, because that's how JS works outside of strict mode.
It's a silly question though, I hope that's not for an interview...
I was just looking at interview questions lol
But one of the questions i got asked in 2 interviews is an async question
A company that would give me that as an interview question gets an almost instant "no" from me, honestly.
setTimeout(function() { console.log(1) }, 1000);
setTimeout(function() { console.log(2) }, 0);
console.log(3)
what print order will be
that question was asked
thats silly too
That's less silly than the one you posted earlier.
Try this one @Jony: No executing please :P
ok
promises lol
17:17
const o = {
  f: function() {
    console.log(this);
  }
}

o.f(); // what's printed?
3,2,1 is my best guess but 2,3,1 is a possible answer
the object of o?
@Jony Correct
That was the easy half
const o = {
  f: function() {
    console.log(this);
  }
}

const g = o.f
g(); // NOW what's printed?
hmm
no idea
Take a guess
Explain your thoughts
17:19
hmm
anarchy is what's printed
literally prints out "ANNNNAAARRRRCCCHHHYYYYYY!!!!"
i think in this case, this will call the function
so might be stackoverflow calling over and over?
xD
@Jony No, you're only calling the function once.
You know that in JavaScript, functions are just objects, right?
So you can assign a function to a variable, no problem, this is what I've done here.
ye but never tried to print a function
so idk how the print looks like
It's not printing a function
It's printing this, the real question here is what would this be in this scenario
17:21
I think it is clearer if you shot it like this:
g = o.f
adding the const means that the answer is dependent on implementation
@DavidKamer You mean ===?
@DavidKamer No it doesn't
So wouldnt it print the same as o.f() directly?
@Jony That is implied, otherwise I wouldn't have asked :)
So declaring const g in a function will produce the same result?
@DavidKamer 1. Yes. 2. Who told you this was in a function?
This is the code you're given, don't add context that doesn't belong.
To alleviate your concerns
17:23
@MadaraUchiha huh, well that pisses me off
(() => {
  const o = {
    f: function() {
      console.log(this);
    }
  }

  const g = o.f
  g(); // NOW what's printed?
})();
Does the exact same thing.
no, a named function
function test()
you are still right, I tested it
@DavidKamer That doesn't matter at all.
Would it do the same in strict mode?
And most people do think like you and are wrong on this question :)
17:24
@MadaraUchiha I know, that pissed me off.
@DavidKamer Now if you ask me that during the interview, you'd pass the question no matter if you answer correctly or not.
wait
@MadaraUchiha lol, this is why some people hat JS
so it prints a named function?
@Jony No, the answer is that it would print window
17:24
lol why
And the explanation is... "because"
@MadaraUchiha hehe
I'll elaborate
When you call a function, its this is dynamically assigned at the time of the function call
Without trickery, this is set to whatever is behind the dot operator
foo.bar(); // this is foo
foo.bar.baz(); // this is foo.bar
But what if there's nothing behind the point? bar()
that's wild
In that case, this will be set, by default, to window. Because that's what the specs say.
@DavidKamer's question on strict mode was on point though
17:27
Ah
In strict mode, the implicit this when there's nothing behind the dot will be set to undefined instead of window.
every day I'm more convinced that this language is bad for the health
@MadaraUchiha I'd say about 90% of what I do is in strict mode
@DavidKamer I'd say more, since Webpack adds strict mode implicitly when you use modules.
So if hteres nothing behind, the default value is window object
17:27
@Jony Yes
and thats a question thats been asked for juniors?
And it doesn't matter where you run the function, which is why @DavidKamer's original guess that if you run it inside of a function the result would be different, was wrong.
@MadaraUchiha That's what I meant. The other 10% is screwing around with code on SO and MDN
@Jony That's a question that's asked of seniors.
And most of the people we interview don't answer that first part correctly, either.
Want another one?
ye
17:29
I think JS needs a standard certification test... (waits for stoning by large crowd)
/* HTML looks like this:
    <div id="div">
      <button id="button">Click me!</button>
    </div> */

const div = document.getElementById('div');
const button = document.getElementById('button');

div.addEventListener('click', function() { alert('Div clicked!'); });
button.addEventListener('click', function() { alert('Button clicked!'); });
before i start
do u use const in purpose lol
@Jony I default to const always.
If I need to reassign, I use let
well
idk whats () =>
Never var.
17:31
whats empty ()
it's just an arrow function for the event listener
@Jony Here
so its the same as function() {
@Jony Yes
ok
17:31
there he changed it
The question is: What will happen when the button is clicked?
my bet is the div alert
div alert
and after close
button alert
@Jony Why?
cause you first click the div, and then the childs
17:32
alerts immediately interrupt focus though
You're both wrong :)
lol is it just button
event bubbling?
@DavidKamer Yes
ok so button and then div
nice
17:33
@Jony Are you familiar with the term "event bubbling"?
You too @forresthopkinsa
nop
I am now lol
So DOM events, by default, bubble.
> When an event happens on an element, it first runs the handlers on it, then on its parent, then all the way up on other ancestors.
In which direction do bubbles... bubble?
17:34
up. Nice
ahh
These are fun (as someone who hardly knows any JS)
So firstly it runs the child events
and then the parents?
Yes
Question for you @DavidKamer
@MadaraUchiha uh oh lol ok
17:35
If I wanted to make the div listener trigger first
How would I go about doing that?
I have a crazy solution that wouldn't be the best solution lol
@DavidKamer Shoot
I know there is a good answer, but my bad answer is:
capturing
Why couldn't people just use em to design software from the beginning
17:37
/* HTML looks like this:
    <div id="div">
      <button id="button">Click me!</button>
    </div> */

const div = document.getElementById('div');
const button = document.getElementById('button');

div.addEventListener('click', function() { alert('Div clicked!'); });
button.addEventListener('click', function() { setTimeout(()=>{alert('Button clicked!');},0); });
Alright, let's approach from a different angle
I think that I learned something more specific before
@MadaraUchiha Another question I got asked:
How would I make it so the event stops at the button?
addeventlistener(x, x, true)
17:38
e.preventDefault()?
@DavidKamer No
stopPropagation()
?
@forresthopkinsa Yes
:D
preventDefault is wrong, would be stopPropagation
17:38
const buttons = [...] // imply there are button elements...
for (let i = 0; i < buttons.length; i++) {
    buttons[i].addEventListener('click', () => alert("Clicked: " + i);
}
Every button will print the last i value
How do u make it print the actual i value ?
I've been reading a great article about bubbling for the past few minutes
@Jony No, it wouldn't, because you used let
without saving it as attr
I think you spoiled the answer :D
ops
i spoiled it
it meant to put let outsiode
17:39
hahahha
XD
@Jony Here's a question right back out you, using only var and no let allowed
but yea they asked me that and i didnt know :(
How would you make it work as expected anyway?
Does event bubbling occur in strict mode/React? I don't think I've run into a situation that I've had to use stopPropogation recently maybe ever.
17:39
@DavidKamer Now, combining the two, I want the div to stop the propagation down to the button
xD save i as attribute
@DavidKamer Of course
@Jony one moment
@DavidKamer Here's a real case scenario: I want to block the click if under the div I have something that's a paid feature, and the user had not paid.
for (var i = 0; i < 5; i++) {
  setTimeout(function() { console.log(i); }, 0);
}
well I know that preventDefault() is used to prevent a form from subitting, so I would, once agian, guess that.
17:41
@Jony No DOM elements for you to set attributes on.
What do you do now? :)
create a new var?
and put that one
how do you stopPropagation in the capture phase?? this is puzzling
@Jony Try it.
ohhi
@forresthopkinsa You do exactly that.
17:42
do it like log(i = b = i
lol
so b will be created in global scope
idk
omg im confused
You call e.stopPropagation() and set capturing mode
ohhh so you just do that right in the capturing event listener
NICE
'duh' moment for me lol
Here's a little known tidbit, every React event can be placed in capture mode by adding Capture at the end of the prop name
<div onClickCapture={() => magic} />
@Jony The problem here is that they're all getting the same i
Because, remember var has hoisting
The way we used to solve this, before let came along, was to use something like this:
Nice you gave me the full picture today
for (var i = 0; i < 5; i++) {
  (function(scopedI) {
  	setTimeout(function() { console.log(scopedI); }, 0);
  })(i)
}
17:44
so stopPropogation will stop event bubbling, but preventDefault will stop events in children elements
@DavidKamer No, preventDefault and stopPropagation do two completely different things
preventDefault will prevent the default browser behavior, links won't transfer to another page, forms won't submit, etc.
you stopPropagation during the capture phase
@MadaraUchiha yeah, I realized that after I sounded like an idiot lol
damn thats complex
stopPropagation will stop the event from continuing, bubble or capture phase.
@Jony There's actually a lot of trickery involved with making let work as well, because technically let is block scoped, but the variable is still defined outside of the block of the loop.
That is like a 10th of the information they gave to the simpler preventDefault
afk lunch
what I understood about let, is that it searches outside of the scope till it finds something
@Jony No, that's JavaScript in general
(function() {
  var i = 42;
  (function() {
    (function() {
      (function() {
        (function() {
          console.log(i); // prints 42
        })();
      })();
    })();
  })();
})();
This will be true for var, let and const.
17:48
how hard is it to update a package for all of your dependencies?
@Jony The difference between var and let is a bit subtle. var is scoped to the nearest function and let is scoped to the nearest block
function foo() {
  if (true) {
    var x = 42;
    let y = 43;
  }
  console.log(x); // 42
  console.log(y); // ReferenceError: y is not defined
}
y's scope ends at the end of the if block
:43712733 //meaning that these are different:
 {
  let a;
 }
 {
  var a;
  }
But x is scoped to the whole function
var also undergoes what's called hoisting, it means that the declaration of the variable is hoisted to the top of the function
console.log(x); // undefined
var x = 5;

// equivalent to

var x;
console.log(x);
x = 5;
With let, on the other hand, you get the more expected ReferenceError if you try to access a variable before it got defined.
const is exactly like let, (block scoped, no hoisting, etc), except that you can't reassign to const
let x = 5;
x = 6; // no problem

const y = 5;
y = 6; // TypeError: Assignment to constant variable
(I love that error, by the way, constant variable :DDDDD)
Right, shower time
If you guys have questions, ping me, and I'll answer when I get back.
Who said that JS was easy?
js is just math
Is there a way to easily visualize how a package is used in my package-lock.json file?
like I have a vulnerable package and I want to make a pull request to fix it, but I'm having trouble figuring out all of the packages that depend on it and how
17:59
Basecamp (Ruby on Rails) is investing time in a lib that uses MutationObservers to inject server content into the dom (like a SPA).

What do you think? Big step forward or unknowingly reinventing the wheel? https://stimulusjs.org/reference/controllers

« first day (2869 days earlier)      last day (2304 days later) »