THIS in JS
this in a Method
when uused in an object mothod,
this refers to the object.
In the example on top of this page,
this refers to the person object
Because the fullName method is a method
of the person object
fullName : function() {
return this.firstName + " " + this.lastName;
}
this Alone
when used alone, this refers to the global object
Because this is running in the global scope.
In a browser window the global object is [object Window]
In strict mode, when used alone, this also refers to the global object:
this in Event Handlers
In HTML event handlers, this refers to the HTML
element that received the event
예시)
Click to Remove Me!
Arrow Function
let myFuncion = (a,b) => a*b;
예) hello = (val) => "hello" + val;
JavaScript JSON
Json은 웹페이지에서 서버로 데이터를 보낼때
사용된다
JSON:JavaScript Object Notation