Open Side Menu Go to the Top

01-02-2018 , 01:57 AM
Quote:
Originally Posted by Larry Legend
I've been really studying and working towards becoming an expert in the javascript language, and it's amazing how much faster things become when you have stronger fundamentals.

I look back at myself 6 months ago and compared to now I was ****ing useless. I cant wait to keep pushing and see where I'll be in another 6 months.
What kind of resources have you been using? Ive been trying to advance in the node realm, but everything on the internet seems to be for newbs
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
150% up to $2,000 Welcome Bonus on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
01-02-2018 , 04:24 PM
I've just been doing a lot of pretty basic searches like "advanced javascript interview questions" and then going down a search hole from there. So many articles/blogs have anchor links to other blogs/articles and I'll spend some time literally following every one.

I also am reading (And rereading) both The good parts and a javascript "ninja" book which kinda repeat content but are helpful.

Also setting breakpoints in my code and walking through react internals has helped me learn how most things are just small functions and not actually that intimidating.

Stuff like the event loop and scope are probably basic to you but visualizing the event loop is still really helpful for me to understand how complex looking functions behave in a more fundamental way.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 05:20 PM
Wouldn't bother "mastering" the OOP parts of javascript imo.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 07:03 PM
Yea, I basically just avoid all of that. I also wanted to ask if people ever use the "new" keyword? I find it kinda weird and ugly, and would think any code I'm looking at that uses it is likely ancient, and proceed cautiously, is that wrong?

Also, today I was "giving back" to the bootcamp I attended and doing some mock interviews with people in a class. I asked this question:

Code:
let myObj = {
  name: "david",
  id: 5
};

let myStr = "ben";

let myNum = 5;

let myBool = true;

const x = function (obj, str, num, bool) {
  obj.name = "john";
  str = "donald";
  num = 10;
  bool = false;
}

x(myObj, myStr, myNum, myBool)
console.log(myObj, myStr, myNum, myBool)

// what will be logged?
And someone came to me during their lunch and asked about it specifically. I pulled up a couple websites and walked them through the official explanations of how objects are passed by reference, and I saw that "null" is pass by value. But I know that the typeOf(null) is an object because of the original implementation. So I explained the null thing quickly, but I was taken aback at trying to teach a simple concept to someone needing to have that quirk explained. How this wasn't corrected early on really blew my mind.

I also found this:



That's obviously completely wrong right? If you pass an object as a function argument, you are referencing the same object in memory inside that function, so if you make changes to it, then you'll be changing the original object as well. This is like the whole reason for stuff like immutable.js right?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 07:18 PM
Quote:
Originally Posted by Larry Legend
Yea, I basically just avoid all of that. I also wanted to ask if people ever use the "new" keyword?


use new for 2 things: new Date(), and making an empty array of foo size usually so you can do the bastardized version of range i.e. const range10 = new Array(10).fill(true).map((el, i) => i)

don't use const for objects or arrays unless you're actually reassigning them.

don't use the function keyword ever other than exports.

10 seconds in console proves it passes by reference btw dunno what that article's about.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 08:07 PM
Quote:
Originally Posted by Larry Legend
That's obviously completely wrong right? If you pass an object as a function argument, you are referencing the same object in memory inside that function, so if you make changes to it, then you'll be changing the original object as well. This is like the whole reason for stuff like immutable.js right?
That is still pass-by-value - it's just the value in this instance is a reference to the object. Pass-by-reference means even if you reassign the object entirely that would cause the caller to now point to a different object. For instance:

Code:
function byRef(obj) {
   obj = { a: 5, c: 2 };
}


function main() {
   x = { b: 1, d: 3 };
   byRef(x);
   // with pass-by-reference, x is now { a: 5, c: 2 };
}
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 08:10 PM
Various answers here also explain this (Java and JavaScript are basically the same in this regard):

https://stackoverflow.com/questions/...-pass-by-value
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 08:32 PM
Ok so this is the summary snippet I have found that seems pretty clear to me.

"Javascript uses a pass by value strategy for primitives but uses a call by sharing for objects. Call by sharing is largely similar to pass by reference in that the function is able to modify the same mutable object but unlike pass by reference isn't able to assign directly over it."

So you can mutilate the object, but you can't just re-assign it. I'm glad I understand this now.

Instead of const for objects what should I be using? Just let always?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 08:45 PM
My work uses new and classes everywhere so Ive basically gone down the rabbit hole on reading about prototype inheritance. Definitely seems like were missing out on the good stuff in javascript by treating it like a completely OO language
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 08:45 PM
sorry I meant dont use let for objects or arrays not const. use const. use let only when it needs to be reassigned.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 08:48 PM
ok yea I do that, I was worried at first.

I used let in that example so as to not have them think const vs let mattered.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 08:57 PM
I personally like let for objects and arrays that will be modified. That way let signifies "this thing changes"
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 09:52 PM
^^ haven't thought of that, clever. Wonder if there's lint rules around let/const on collections.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 10:05 PM
Quote:
Originally Posted by Larry Legend
I've just been doing a lot of pretty basic searches like "advanced javascript interview questions" and then going down a search hole from there. So many articles/blogs have anchor links to other blogs/articles and I'll spend some time literally following every one.

I also am reading (And rereading) both The good parts and a javascript "ninja" book which kinda repeat content but are helpful.

Also setting breakpoints in my code and walking through react internals has helped me learn how most things are just small functions and not actually that intimidating.

Stuff like the event loop and scope are probably basic to you but visualizing the event loop is still really helpful for me to understand how complex looking functions behave in a more fundamental way.
sudoku ftmfw!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 10:23 PM
Can you not copy text messages anymore in iOS whatever? I am pushing it and nothing happens. You also can't send DMs from your computer on Instagram. Which is just ****ing brilliant because who doesn't love typing DMs on their phone? So I said I will just type it on the computer and text it to myself. And now I can't copy it. **** the internet man.

Edit: Welp, 79th time is a charm as for some reason now it worked.

Edit edit: ok now it's having problems again. For some reason my phone isn't responding to the long press needed to get the copy/paste menus to show up. Fun. I blame Kerowo.

Last edited by suzzer99; 01-02-2018 at 10:37 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-02-2018 , 11:30 PM
That's probably caused by the battery slowing down your OS.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-03-2018 , 12:18 AM
Its funny, the stuff that suzzer complains about are the exact same things that tilt me, and sometimes it takes me seeing them through the experience of others to realize this stuff really is a problem for everyone.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-03-2018 , 04:39 AM
Quote:
Originally Posted by daveT
That's probably caused by the battery slowing down your OS.
Had to go to the Apple store today when my work machine crapped out and there was an older Chinese man that was irate about this. Basically they scheduled a genius bar appt for him to get his battery replaced and didn't have any batteries in stock. He made the poor tech support gal sit with him while he read entire EULA in front of her out of spite. After that he spent 15 minutes lecturing the manager about how they should be doing business and how Apple is still lying about throttle gate
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-03-2018 , 11:06 AM
Quote:
Originally Posted by suzzer99
Can you not copy text messages anymore in iOS whatever? I am pushing it and nothing happens. You also can't send DMs from your computer on Instagram. Which is just ****ing brilliant because who doesn't love typing DMs on their phone? So I said I will just type it on the computer and text it to myself. And now I can't copy it. **** the internet man.

Edit: Welp, 79th time is a charm as for some reason now it worked.

Edit edit: ok now it's having problems again. For some reason my phone isn't responding to the long press needed to get the copy/paste menus to show up. Fun. I blame Kerowo.
Yeah, they ****ed us with force touch only being around for a couple of phones, I had to push and pray a few times before my ten would give the option to copy the message...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-03-2018 , 05:16 PM
Jesus, I always forget how ****ty Apple software is until I have to set up a new machine.

Remapping keys from modifier keys in system preferences > keyboard? Doesn't work. Installing xcode via app store? Takes forever, button changes from install to open but won't actually open the application. Further research indicates that it was in fact not installed.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-03-2018 , 05:54 PM
Quote:
Originally Posted by Larry Legend
any code I'm looking at that uses it is likely ancient, and proceed cautiously, is that wrong?
'new' is used everywhere es6 classes are used, which are still popular in lots of libs, even if they hide it in the constructor. There has been a push for a more functional style and composition over inheritance (probably rightly so) but that doesn't mean all code using the 'new' keyword is old or bad.

imo don't become one of those guys that dives into minutia and thinks minor stylistic things are what differentiates good devs from bad. learn basic data structures and algorithms and solve problems so you actually get good at programming instead of just configuring other peoples frameworks. If you're doing js, you should also learn everything you can about observables, promises and generators and learn to wrangle asynchronous code.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-05-2018 , 11:57 AM
I got a unsolicited job offer (to interview) at Reddit just because of my game Two months too late oh well.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-05-2018 , 01:36 PM
Reddit seems out of sync with it’s users a little, not sure it would be that great a place to work.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-05-2018 , 01:47 PM
Huge career move though.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-05-2018 , 02:38 PM
If Reddit can do the things it does/ has done and be successful, I can't really imagine how high their ceiling is tbh.

I'm finding myself becoming incredibly uninterested in the project I am on, but it is having an interesting side effect. I'm being way more careful about the code I send to QA because I absolutely dread making this project last any longer than scheduled and I want to never need to checkout a branch after PRing it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
150% up to $2,000 Welcome Bonus on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m