“это ключевое слово в JavaScript” Ответ

это ключевое слово в среде JavaScript

For All Regular function, this points to the WINDOW Object ( Global Context ) .
Enchanting Eel

Это JavaScript

//this refer to global object or window object
//but when we call this inside method of object it refers to current object
console.log(this===window)//true
let user = {
  name: "Shirshak",
  age: 25,

  sayHi() {
    // "this" is the "current object"
    console.log(this.name); //print shirshak
  }
};
Shirshak kandel

Использование этого ключевого слова в JS

The JavaScript this keyword refers to the object it belongs to. 
It has different values depending on where it is used: In a method, 
this refers to the owner object. Alone, this refers to the global 
object.
Viper

новое ключевое слово в JS

**Important Points** 

1.It creates a new object. The type of this object is object.
2.It sets this new object's internal, inaccessible, [[prototype]] (i.e. __proto__) property to be the constructor function's external, accessible, prototype object (every function object automatically has a prototype property).
3.It makes the this variable point to the newly created object.
4.It executes the constructor function, using the newly created object whenever this is mentioned.
5.It returns the newly created object, unless the constructor function returns a non-null object reference. In this case, that object reference is returned instead.
Note: constructor function refers to the function after the new keyword, as in

new ConstructorFunction(arg1, arg2)
Wandering Wolf

это ключевое слово в JavaScript

// this keyword

// This keyword belongs to the object it belongs to
// (1).Alone, this refers to the global object.
// (2).In a regular function,this refers to the global object.
// (3).In a method, this refers to the owner object.

// 1
console.log(this);

// 2
function abc() {
  console.log(this);
}
abc();

// 3
const obj = {
  name: "Abhishek",
  no: 1,
  sum: function (a, b) {
    console.log("hello sum", a + b);
    console.log("this:::", this);
    console.log("this name:::", this.name);
  },
};

obj.sum(4, 3);
Abhishek

это ключевое слово в JavaScript

// In JavaScript, the this keyword refers to an object.

const person = {
  firstName: "John",
  lastName : "Doe",
  id       : 5566,
  fullName : function() {
    return this.firstName + " " + this.lastName;
  }
};
Tiny Coders

Ответы похожие на “это ключевое слово в JavaScript”

Вопросы похожие на “это ключевое слово в JavaScript”

Больше похожих ответов на “это ключевое слово в JavaScript” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования