尊龙凯时人生就是博

ÔõÑùÈ¡jsÖÐjsonµÄÖµ

´Ó js ¹¤¾ß»ñÈ¡ json ÖµµÄÒªÁì°üÀ¨£º¹¤¾ß×ÖÃæÁ¿£ºÊ¹ÓõãÌåÏÖ·¨»ò·½À¨ºÅÌåÏÖ·¨Ö±½Ó¼ìË÷Öµ¡£µãÌåÏÖ·¨£º¼ò»¯µÄ¹¤¾ß×ÖÃæÁ¿»á¼û·½·¨¡£·½À¨ºÅÌåÏÖ·¨£ºÔÊÐíʹÓñäÁ¿»ò±í´ïʽ×÷Ϊ¼üÃû¡£Ç¶Ì×¹¤¾ß£ºÊ¹ÓõãÌåÏÖ·¨»ò·½À¨ºÅÌåÏÖ·¨ÒÀ´Î»á¼ûǶÌ׵ļü¡£

ÔõÑù»ñÈ¡ JS ÖÐ JSON µÄÖµ

JSON£¨JavaScript Object Notation£©ÊÇÒ»ÖÖÇáÁ¿¼¶µÄÎı¾ÃûÌã¬ÓÃÓÚÔÚ²î±ðƽ̨ºÍϵͳ֮¼ä´«ÊäÊý¾Ý¡£ÎªÁË´Ó JS ¹¤¾ßÖлñÈ¡ JSON µÄÖµ£¬¿ÉÒÔʹÓÃÒÔÏÂÒªÁ죺

¹¤¾ß×ÖÃæÁ¿

×îÖ±½ÓµÄ·½·¨ÊÇ´Ó¹¤¾ß×ÖÃæÁ¿ÖмìË÷Öµ£º

const person = {
  name: "John Doe",
  age: 30,
  address: "123 Main Street"
};

const name = person.name; // "John Doe"
const age = person.age; // 30
const address = person.address; // "123 Main Street"

µÇ¼ºó¸´ÖÆ

µãÌåÏÖ·¨

µãÌåÏÖ·¨Êǹ¤¾ß×ÖÃæÁ¿µÄ¼òд£º

const name = person.name;
const age = person.age;
const address = person.address;

µÇ¼ºó¸´ÖÆ

·½À¨ºÅÌåÏÖ·¨

·½À¨ºÅÌåÏÖ·¨ÔÊÐíʹÓñäÁ¿»ò±í´ïʽ×÷Ϊ¼üÃû£º

const key = "name";
const name = person[key]; // "John Doe"

µÇ¼ºó¸´ÖÆ

ǶÌ×¹¤¾ß

¹ØÓÚǶÌ׵Ť¾ß£¬Ê¹ÓõãÌåÏÖ·¨»ò·½À¨ºÅÌåÏÖ·¨ÒÀ´Î»á¼ûǶÌ׵ļü£º

const person = {
  name: {
    first: "John",
    last: "Doe"
  }
};

const firstName = person.name.first; // "John"
const lastName = person.name.last; // "Doe"

µÇ¼ºó¸´ÖÆ

ÆäËû×¢ÖØÊÂÏî

ÈôÊǼüÃû°üÀ¨¿Õ¸ñ»òÌØÊâ×Ö·û£¬ÔòÐèҪʹÓ÷½À¨ºÅÌåÏÖ·¨¡£

ÈôÊǼüÃû²»±£´æ£¬Ôò»á·µ»Ø undefined¡£

ÈôÊǼüÃûÖ¸ÏòÒ»¸öº¯Êý£¬Ôò»áŲÓøú¯Êý²¢·µ»ØÆä·µ»ØÖµ¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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