国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

無涯教程-Javascript - For...in循環(huán)語句

這篇具有很好參考價值的文章主要介紹了無涯教程-Javascript - For...in循環(huán)語句。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報違法"按鈕提交疑問。

for ... in 循環(huán)用于循環(huán)訪問對象的屬性,由于無涯教程尚未討論Objects對象,您就會發(fā)現(xiàn)此循環(huán)非常有用。

“ for...in”循環(huán)的語法為:
for (variablename in object) {
   statement or block to execute
}

在每次迭代中,將 object對象中的一個屬性分配給 variablename 變量,此循環(huán)一直進(jìn)行到對象的所有屬性。

請嘗試以下示例來實(shí)現(xiàn)" for-in"循環(huán),它將打印網(wǎng)絡(luò)瀏覽器的 Navigator 對象。

<html>
   <body>      
      <script type = "text/javascript">
         <!--
            var aProperty;
            document.write("NavigatorObjectProperties<br /> ");        
            for (aProperty in navigator) {
               document.write(aProperty);
               document.write("<br />");
            }
            document.write ("Exiting from the loop!");
         //-->
      </script>      
      <p>Set the variable to different object and then try...</p>
   </body>
</html>

運(yùn)行上面代碼輸出

NavigatorObjectProperties 
serviceWorker 
webkitPersistentStorage 
webkitTemporaryStorage 
geolocation 
doNotTrack 
onLine 
languages 
language 
userAgent 
product 
platform 
appVersion 
appName 
appCodeName 
hardwareConcurrency 
maxTouchPoints 
vendorSub 
vendor 
productSub 
cookieEnabled 
mimeTypes 
plugins 
javaEnabled 
getStorageUpdates 
getGamepads 
webkitGetUserMedia 
vibrate 
getBattery 
sendBeacon 
registerProtocolHandler 
unregisterProtocolHandler 
Exiting from the loop!
Set the variable to different object and then try...

參考鏈接

https://www.learnfk.com/javascript/javascript-forin-loop.html文章來源地址http://www.zghlxwxcb.cn/news/detail-595755.html

到了這里,關(guān)于無涯教程-Javascript - For...in循環(huán)語句的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 7 JavaScript循環(huán)語句

    7 循環(huán)語句 在js中有三種循環(huán)語句. 首先是while循環(huán). 它的邏輯和咱們python中的while幾乎一模一樣, 就是符號上有些許的區(qū)別.

    2024年02月12日
    瀏覽(17)
  • JavaScript 其他循環(huán)語句和跳轉(zhuǎn)語句

    一、while語句 While 循環(huán)會在指定條件為真時循環(huán)執(zhí)行代碼塊。 While循環(huán),先進(jìn)行條件判斷,再執(zhí)行循環(huán)體的代碼 如果條件不滿足,則不會執(zhí)行循環(huán)體,一次都不會 案例: 二、do.....while循環(huán) do/while 循環(huán)是 while 循環(huán)的變體。該循環(huán)會執(zhí)行一次代碼塊,在檢查條件是否為真之前

    2024年02月06日
    瀏覽(15)
  • 無涯教程-Lua - for語句函數(shù)

    for 循環(huán)是一種重復(fù)控制結(jié)構(gòu),可讓您有效地編寫需要執(zhí)行特定次數(shù)的循環(huán)。 Lua編程語言中 for 循環(huán)的語法如下- 這是 for 循環(huán)中的控制流程- 首先執(zhí)行 init 步驟,并且僅執(zhí)行一次。此步驟使您可以聲明和初始化任何循環(huán)控制變量。 接下來是max/min。這是循環(huán)繼續(xù)執(zhí)行之前的最大

    2024年02月14日
    瀏覽(20)
  • 無涯教程-JavaScript - IMDIV函數(shù)

    IMDIV函數(shù)以x + yi或x + yj文本格式返回兩個復(fù)數(shù)的商。 $$IMDIV(z1,z2)= frac {(a + bi)} {(c + in)} = frac {{ac + bd)+(bc-ad)i} {c ^ 2 + d ^ 2 } $$ Argument 描述 Required/Optional Inumber1 The complex numerator or dividend. Required Inumber2 The complex denominator or divisor. Required Excel中的復(fù)數(shù)僅存儲為文本。 當(dāng)將格式為\\\" a

    2024年02月09日
    瀏覽(25)
  • 無涯教程-JavaScript - CUMIPMT函數(shù)

    CUMIPMT函數(shù)返回start_period和end_period之間的貸款累計利息。 Argument 描述 Required/Optional Rate The interest rate. Required Nper The total number of payment periods. Required Pv The present value. Required Start_period 計算的第一個期間。 付款期從1開始編號。 Required End_period The last period in the calculation. Required T

    2024年02月09日
    瀏覽(26)
  • 無涯教程-JavaScript - IMPOWER函數(shù)

    IMPOWER函數(shù)以x + yi或x + yj文本格式返回加到冪的復(fù)數(shù)。求冪的復(fù)數(shù)的計算方法如下- $$(x + yi)^ n = r ^ ne ^ {n theta} = r ^ n cos n theta + ir ^ n sin n theta $$ 哪里- $$r = sqrt {x ^ 2 + y ^ 2} ::和::theta = tan ^ {-1} left(frac {y} {x} right): :和::theta epsilon(-pi; pi] $$ Argument 描述 Required/Optiona

    2024年02月09日
    瀏覽(32)
  • 無涯教程-JavaScript - HYPGEOMDIST函數(shù)

    HYPGEOMDIST函數(shù)替代Excel 2010中的HYPGEOM.DIST函數(shù)。 該函數(shù)返回超幾何分布。 HYPGEOMDIST返回給定樣本數(shù)量,給定樣本數(shù)量,總體成功率和總體數(shù)量的概率。 將HYPGEOMDIST用于具有有限總體的問題,其中每個觀察輸出都是成功或失敗,并且給定大小的每個子集的選擇可能性均等。 Argument 描述

    2024年02月10日
    瀏覽(15)
  • 無涯教程-JavaScript - ROW函數(shù)

    ROW函數(shù)返回引用的行號。 Argument 描述 Required/Optional Reference 您想要其行號的單元格或單元格范圍。 如果省略引用,則假定它是出現(xiàn)ROW函數(shù)的單元格的引用。 請參閱下面的注釋。 Optional 如果引用是一個單元格范圍,并且如果將ROW作為垂直數(shù)組輸入,則ROW將引用的行號作為垂直數(shù)組

    2024年02月07日
    瀏覽(30)
  • 無涯教程-JavaScript - DELTA函數(shù)

    DELTA函數(shù)測試兩個值是否相等。如果number1 = number2,則返回1;否則返回1。否則返回0。 您可以使用此功能來過濾一組值。如,通過合計幾個DELTA函數(shù),您可以計算相等對的計數(shù)。此功能也稱為Kronecker Delta功能。 Argument 描述 Required/Optional number1 The first number. Required number2 第二個數(shù)字。

    2024年02月09日
    瀏覽(18)
  • 無涯教程-JavaScript - IMPRODUCT函數(shù)

    IMPRODUCT函數(shù)以x + yi或x + yj文本格式返回1到255個復(fù)數(shù)的乘積。兩個復(fù)數(shù)的乘積為- $$(A + BI)(C + DI)=(AC-BD)(A + B)1 $$ Argument 描述 Required/Optional Inumber1 1 to 255 complex numbers to multiply. Required [inumber2], … 1 to 255 complex numbers to multiply. Optional Excel中的復(fù)數(shù)僅存儲為文本。 當(dāng)將格式為\\\" a + bi\\\"或

    2024年02月09日
    瀏覽(21)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包