What is “this”? Arrow functions.
If you ever programmed in another Object Oriented language, “this” keyword in JavaScript might be very confusing for you. Bear with me, I will show you some Java code.
1 2 3 4 5 6 7 8 9 |
public class Point { int x; int y; public Point(int x, int y){ this.x = x; this.y = y; } } |
Here, the “this” keyword is a reference to the current object, so calling
1 |
this.x = x; |
in the constructor will assign a value to the x property of an […]