Learn javascript

>learn javascript

Attached: 1491915151923.png (694x801, 70K)

No!

that's why you use closures which share the surrounding lexical this.

Or just, like, use modern syntax.
const compareThis = param => {
console.log(this === param);
};
compareThis(this);
>>true

let that = this

JavaScript is a fucking shitshow of a language but once you actually properly understand the bizarre rules and quirks like this, equality and type coercion, typeof, undefined, arguments and all of the language's other retardations it becomes quite fun to work with.

>once you get used to the torture, it becomes fun

>once you get used to it being a steaming pile of shit, it stinks less

at least it has more character than C I guess

JS is the best whiteboarding language

Until you learn a REAL programming language and see all the shit that you're missing out on by using a dynamical-typed, legacy-bloated shitstorm of a language.

It's a much more immediately available scripting language than python by the sheer virtue of being available in any browser ever. And note I'm only talking about it from the perspective of scripting and making simple single-purpose web applications. Node and npm are god fucking awful and webshits need to die.

>REAL programming language
Define "REAL". C? Unfortunately too primitive to be enjoyable to write. C++? Absolutely awful mess of a language. Java? fuck no. Haskell? lol
Really, the only answer I'll accept is LISP because it was perfected from the start.

If I need something quick & dirty, I'd much rather use python. It's just as immediate. If you need a web application for whatever reason, you can compile python to javascript with django or whatever it's called.

Damn, you're a nigger. Well at least there's no threat of your god-awful opinions about things you've decided before actually using anything has no threat of being contagious considering what an unpleasant specimen of human being you are. Enjoy your thread [/tipshat].

>dynamical-typed, legacy-bloated
That tfw when this part of description also applies to one of the best languages(Common Lisp).

Good job admitting that my remark hit a sore spot without actually answering the question of what a real programming language is (which, by the way, I not once implied JavaScript is).

>param

Attached: 1523296725544.gif (480x270, 1.11M)

can you ELI5 the diff between what you wrote and the OP?

Arrow functions (x => x) binds this to the function object while function expressions (function (x) { return x }) don't bind this, which makes it evaluate to undefined (in strict mode) or the global object.
If you need to make use of this, you generally always want to use arrow functions.

Actually, I explained that poorly and slightly incorrectly. Arrow functions capture the value of "this" at the moment the function is declared, while function expressions capture the value of this at the time the function is invoked. This only really matters when using classes and is easily noticed when using callbacks.

var myClass = function () {
this.someArrowFunc = () => console.log(this)
this.someFunctionExpr = function () { console.log(this) }
}
var myObj = new myClass();
setTimeout(myObj.someArrowFunc, 10)
setTimeout(myObj.someFunctionExpr, 20)
// -> Object { ... }
// -> Window

>not learning rust
>not learning wasm

Next year we'll probably have Fuschia apps written in Go and people still use ancient bs

is it wrong that I do that = this

what's the alternative, a router?

use self instead of that

How about a less shit version of Java?

Attached: 0*JLPdbimCEnWB8qJL.png (512x512, 17K)

and holochain

That's python. No braces/semicolons is irrelevant in the editor, but great for avoiding stupid bugs in the board.
Meanwhile js fucks you up for mixing whitespace and semicolons

use _this like real man

begone shill

>reading react hook documentation
>author calls out class method arrow syntax as an unstable proposal

Attached: 4F14364C-018B-4CEB-9642-895FABD60855.jpg (550x550, 26K)

avoid react like the plague
riot.js is where the sense is at

you mean vue.js

Riot.js is dope. My favorite part about riot.js is reading the creator’s comments on Github issues. He’s always defending his tech from wave after wave of plebs

use bind, call, or apply, or an arrow function.

Jesus Christ why do OO-brainlets have such a hard time understanding JavaScript? Read fucking MDN. none of this stuff is hidden or secret.

> JS fags think their "programming" in a truly "compiled" language.
> JS fags consider their cluttered and bloated syntax "normal"
> camel case is gay
> curly braces are gay
> not everything has to exist in a browser
> can't do shit without your gayass dev frameworks

that is what a closure is you fucking retard.

why it works on my browser?

Attached: 2018-12-17-111022_275x140_scrot.png (275x140, 8K)