6

I understand JavaScript but I cannot for the love of fucking JavaScript Zeus understand how the fuck all those front end technologies work. Maaaaaaaan I suck at my job.

Comments
  • 0
    Which one in particular?
  • 1
    function Asd() {
    this.title = "hello";
    }

    Asd.title = "macaroni";

    Asd.say = () => console.log(this.title);

    Asd.prototype.say = function() {
    console.log(this.title);
    }

    const thing = new Asd();

    setTimeout(thing.say, 1000)

    // What gets printed?
  • 0
    @Froot Now there are some faster way to get a random string, you know that right?
  • 1
    @Commodore What? 😄
  • 1
  • 0
    @Froot well I mean, that piece of code is so confusing it basically amounts to returning a random string 😋

    @Archeelux oh now I'm intrigued. With everyone praising vue's documentation, I didn't expect this. Care to elaborate?
  • 0
    @Froot hello, from the constructor set, with the prototype function
  • 0
    @Commodore hehe. It's a good snippet to test if someone really knows JS. Has some under the hood things in there and some added confusion 😀
  • 1
    @oreru you mean "hello"? Nope 😃

    Edit: I should have chosen better strings 😃
  • 1
    @Froot i’m pretty sure it does, will check why i’m dumb later
  • 1
    oooh i think i see it now, good job with the timer ⏲
  • 1
    @oreru yeah 😃
    Edit: do you now know what it returns?
  • 0
    @Froot the title of this that comes from the timer ;)

    if i can spoil i’d say window.title, as the proto func is not bind and DOM callback handling is retarded

    Edit: but i didn’t checked yet so this might still be wrong
  • 0
    @oreru yeap. undefined or if window.title exists then that 😃

    Btw it has nothing to do with the DOM. It's how 'this' reference works 😃
  • 0
    @Froot it works that way, but it’s retarded :D
  • 0
    for ex. in ecmascript they could have put a lazy ‘this’ binding for functions, usable by native objects : it would have removed 90% of beginners incomprehension about ‘this’
  • 0
    @oreru what do you mean by that?
Your Job Suck?
Get a Better Job
Add Comment