尊龙凯时人生就是博

jsÖÐÔõÑùŲÓÃÒªÁì

javascript ÖÐŲÓÃÒªÁìÓÐÁ½ÖÖ·½·¨£º¹¤¾ßÒªÁ죺ʹÓõãºÅÔËËã·û»òÖÐÀ¨ºÅÔËËã·û £»ÄÚÖú¯ÊýÒªÁìºÍÀàÒªÁ죺ʹÓÃÖÐÀ¨ºÅÔËËã·û¡£

ÔõÑùÔÚ JavaScript ÖÐŲÓÃÒªÁì

ÔÚ JavaScript ÖУ¬Å²ÓÃÒªÁì¿ÉÒÔʹÓõãºÅ (.) »òÖÐÀ¨ºÅ ([]) ÔËËã·û¡£Ïêϸ·½·¨È¡¾öÓÚÒªÁìµÄÀàÐÍ¡£

¹¤¾ßÒªÁ죺

µãºÅÔËËã·û£ºÊÊÓÃÓÚ¹¤¾ßÉϵÄÒªÁì¡£

const person = {
name: "John",
greet: function() {
  console.log("Hello, my name is " + this.name);
}
};

person.greet(); // Êä³ö£ºHello, my name is John

µÇ¼ºó¸´ÖÆ

ÖÐÀ¨ºÅÔËËã·û£ºÒ²¿ÉÒÔÓÃÓÚ¹¤¾ßÉϵÄÒªÁ죬µ«ÐèҪʹÓÃ×Ö·û´®ÌåÏÖÒªÁìÃû¡£

const person = {
name: "John",
["greet"() {
  console.log("Hello, my name is " + this.name);
}
};

person["greet"](); // Êä³ö£ºHello, my name is John

µÇ¼ºó¸´ÖÆ

ÄÚÖú¯ÊýÒªÁ죺

ÖÐÀ¨ºÅÔËËã·û£ºÓÃÓÚŲÓÃÄÚÖú¯ÊýµÄÒªÁ죬ÀýÈçÊý×éµÄ map ÒªÁì¡£

const numbers = [1, 2, 3];

const doubledNumbers = numbers.map(function(number) {
return number * 2;
});

console.log(doubledNumbers); // Êä³ö£º [2, 4, 6]

µÇ¼ºó¸´ÖÆ

ÀàÒªÁ죺

µãºÅÔËËã·û£ºÊÊÓÃÓÚÀàµÄʵÀýÉϵÄÒªÁì¡£

class Person {
constructor(name) {
  this.name = name;
}

greet() {
  console.log("Hello, my name is " + this.name);
}
}

const person = new Person("John");

person.greet(); // Êä³ö£ºHello, my name is John

µÇ¼ºó¸´ÖÆ

ÒÔÉϾÍÊÇjsÖÐÔõÑùŲÓÃÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ