JS基础教程——JavaScript基础知识(1.4数组-1.4.2数组常量)

2013-12-21 liyangweb.com 李杨 JavaScript

数组是一些数据的集合,在JavaScript中,数组中的数据可以是任何数据类型,数组可以通过数组直接量定义数组。所谓数组直接量就是通过中括号语法直接包含一组数据,或者也可以称之为数组常量。中括号内每个元素序列通过逗号语法分隔,例如,使用数组直接量定义数组。当然,数组结果是可以嵌套的,例如:

var a = [[1,2],{x:1,y:2},function(){alert("liyangweb")}];


数组中不仅可以包含任意类型的数组,还可以包含任意形式的表达式。例如:

var a = [(3-2),(3<2),(true)?1:0];


上面数组的第一个元素值为一个简单的算数表达式,第二个元素值为一个比较运算表达式,第三个元素值为一个条件表达式。

当然,JavaScript也尅使用数组直接量创建空数组,定义的方法是在逗号之间省去元素的值,此时元素的默认值为undefined,例如:

var a = [,,,,,];

 

标签: JavaScript JS基础教程

评论:

pruvitallday
2019-02-11 15:08
<a href="http://www.eworklife.com/air-jordan-retro-1-orange-royal-blue-sneakere">air jordan retro 1 orange royal blue</a> <a href="http://www.fullcountkbo.com/nike-huarache-ultra-himmelen-bl%C3%A5-bl%C3%A5-obuvc">nike huarache ultra himmelen bl氓 bl氓</a> <a href="http://www.shackofstones.com/nfl-donte-moncrief-mens-limited-gold-jersey-10-jacksonville-jaguars-nike-rush-vapor-untouchable-nflw">nfl donte moncrief mens limited gold jersey 10 jacksonville jaguars nike rush vapor untouchable</a> <a href="http://www.tamworthbacon.com/detroit-lions-jason-hanson-jersey-nflv">detroit lions jason hanson jersey</a> <a href="http://www.dvmengineers.com/nike-air-max-90-essential-trainers-pale-grey-skog">nike air max 90 essential trainers pale grey</a> <a href="http://www.questoffine.com/nike-free-flyknit-5.0-fiyat-navigation-skob">nike free flyknit 5.0 fiyat navigation</a>
pruvitallday http://www.pruvitallday.com/
destinyrail
2019-01-28 17:07
<a href="http://www.wanbilm.com/nike-free-flyknit-5.0-v2-grigio-marrone-chaussuresf">nike free flyknit 5.0 v2 grigio marrone</a> <a href="http://www.yogadesfemmes.com/air-jordan-12-ovo-for-verkauf-florida-butya">air jordan 12 ovo for verkauf florida</a> <a href="http://www.ahlyons.com/air-jordan-4-schwarz-and-gold-guide-schuheg">air jordan 4 schwarz and gold guide</a> <a href="http://www.dmmsband.com/hombres-ralph-lauren-stripe-polo-gris-marr%C3%B3n-polou">hombres ralph lauren stripe polo gris marr贸n</a> <a href="http://www.forautoquotes.com/nike-air-pegasus-92-decon-qs-grigio-hair-chaussuresa">nike air pegasus 92 decon qs grigio hair</a> <a href="http://www.johnkristoff.com/dam%C3%A4nner-nike-air-max-tailwind-5-grau-rosa-schuhee">dam盲nner nike air max tailwind 5 grau rosa</a>
destinyrail http://www.destinyrail.com/
chatavalanche
2019-01-10 05:41
<a href="http://www.royalwaxqueen.com/oakley-holbrook-sunglasses-xord-mechon-sunglassesa">oakley holbrook sunglasses xord mechon</a> <a href="http://www.faithstarters.com/kansas-city-royals-hat-with-crown-75-hatd">kansas city royals hat with crown 75</a> <a href="http://www.valeriewiener.com/ray-ban-clubmaster-dupe-kodak-sunglassesg">ray ban clubmaster dupe kodak</a> <a href="http://www.smsteachers.com/undefeated-air-jordan-8-skox">undefeated air jordan 8</a> <a href="http://www.eatisrael.com/nike-air-max-95-kvinders-r%C3%B8d-skoc">nike air max 95 kvinders r酶d</a> <a href="http://www.cutlaroc.com/foot-locker-nike-air-max-hyperfuse-skob">foot locker nike air max hyperfuse</a>
chatavalanche http://www.chatavalanche.com/
clumsford
2019-01-10 02:59
<a href="http://www.sellingmason.com/nike-free-run-2-svart-and-turquoise-chaussuresf">nike free run 2 svart and turquoise</a> <a href="http://www.soflexdance.com/air-max-1-negro-mujeres-scarpee">air max 1 negro mujeres</a> <a href="http://www.visiotimes.com/nike-mens-wesley-woodyard-elite-green-jersey-tennessee-titans-nfl-59-salute-to-service-nfls">nike mens wesley woodyard elite green jersey tennessee titans nfl 59 salute to service</a> <a href="http://www.whitegayshop.com/dam%C3%A4nner-ralph-lauren-city-polo-grau-beige-polox">dam盲nner ralph lauren city polo grau beige</a> <a href="http://www.alahedsports.com/color-rush-dak-prescott-jersey-nflz">color rush dak prescott jersey</a> <a href="http://www.beautyestyle.com/asics-ladies-gel-hyper-33-sko-sort-kurpesc">asics ladies gel hyper 33 sko sort</a>
clumsford http://www.clumsford.com/
nvusforex
2019-01-06 13:27
<a href="http://www.culturalsq.com/kirk-cousins-8-washington-redskins-jersey-nflv">kirk cousins 8 washington redskins jersey</a> <a href="http://www.tiaracara.com/purple-green-womens-nike-air-waffle-shoes-skof">purple green womens nike air waffle shoes</a> <a href="http://www.shaunasbags.com/nike-dunk-sky-hi-mesh-olive-skob">nike dunk sky hi mesh olive</a> <a href="http://www.tomtaylorblog.com/how-to-make-a-baby-elf-hat-50-hatb">how to make a baby elf hat 50</a> <a href="http://www.pistonari.com/air-max-1-youth-black-runningf">air max 1 youth black</a> <a href="http://www.rebeccastaste.com/nike-free-run-5.0-v4-sail-lyser%C3%B8d-noise-schuhea">nike free run 5.0 v4 sail lyser酶d noise</a>
nvusforex http://www.nvusforex.com/
chiveshow
2018-12-29 14:43
<a href="http://www.betsydorman.com/air-jordan-7-retro-infrar%C3%B8d-lights-schuhec">air jordan 7 retro infrar酶d lights</a> <a href="http://www.lukonsult.com/nike-zoom-alle-out-lila-braun-butyf">nike zoom alle out lila braun</a> <a href="http://www.raynne.com/wmns-air-max-1-light-magenta-royal-blau-butyf">wmns air max 1 light magenta royal blau</a> <a href="http://www.rodabroad.com/nike-air-huarache-blanco-jd-obuvf">nike air huarache blanco jd</a> <a href="http://www.tzoning.com/femminile-nike-huarache-ultra-tutti-gituttio-obuve">femminile nike huarache ultra tutti gituttio</a> <a href="http://www.zarabahmani.com/nike-kaishi-arancia-hair-kurpesg">nike kaishi arancia hair</a>
[url=http://www.chiveshow.com/]chiveshow[/url]
angguvenlik
2018-12-29 08:56
<a href="http://www.opelbeyinleri.com/nike-free-fonctionnement-violet-kurpesc">nike free fonctionnement violet</a> <a href="http://www.pazoga.com/nike-free-5.0-w-light-azul-obuvg">nike free 5.0 w light azul</a> <a href="http://www.rahwindsor.com/adidas-zx-flux-monochrome-prism-for-verkauf-scarped">adidas zx flux monochrome prism for verkauf</a> <a href="http://www.salessteelbar.com/nike-hyperdunk-low-lux-svart-butya">nike hyperdunk low lux svart</a> <a href="http://www.harpiabd.com/nike-free-6.0-lyser%C3%B8d-lilla-chaussuresf">nike free 6.0 lyser酶d lilla</a> <a href="http://www.katiagrinkov.com/nike-kd-lifestyle-rosso-wings-butya">nike kd lifestyle rosso wings</a>
angguvenlik http://www.angguvenlik.com/

发表评论:

Powered by emlog 冀ICP备13011830号-1