第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

如何將單詞從對象打印到j(luò)avascript中的指定位置

如何將單詞從對象打印到j(luò)avascript中的指定位置

白衣非少年 2021-04-09 18:15:47
我在javascript中有對象,對象的鍵是我的段落中的單詞,如何在段落中打印它.Value(key:value)保持其位置。嘗試使用for循環(huán)獲取對我不起作用var userdata= {          "\"Ten": [            0          ],          "blue": [            1          ],          "links\"": [            2          ],          "have": [            3          ],          "defined": [            4          ],          "web": [            5,            36,            65          ],          "search": [            6,            32,            37,            70,            90,            108,            126          ],          "results": [            7,            33,            38,            71,            82,            99,            119          ],          "for": [            8,            80          ],          "the": [            9,            28,            56,            61,            69,            95,            105          ],          "last": [            10          ],          "fifteen": [            11          ],          "years": [            12          ],          "--": [            13          ],          "snippets": [            14          ],          "of": [            15,            30,            63,            97,            107,            125          ],        };“十個(gè)藍(lán)色鏈接”定義了過去十五年的網(wǎng)絡(luò)搜索結(jié)果-文本片段以及文檔標(biāo)題和URL。在本文中,我們建立了增強(qiáng)搜索結(jié)果的概念,將Web搜索結(jié)果擴(kuò)展到包括圖像和視頻之類的多媒體對象,特定于意圖的鍵值對以及允許用戶直接與網(wǎng)頁內(nèi)容進(jìn)行交互的元素從搜索結(jié)果頁面。我們顯示,用戶明確地以及在其搜索行為中觀察到時(shí)都表達(dá)了對增強(qiáng)結(jié)果的偏愛。我們還展示了增強(qiáng)結(jié)果在幫助用戶評估搜索結(jié)果的相關(guān)性方面的有效性。最后,我們證明了我們可以有效地生成增強(qiáng)的結(jié)果,以覆蓋搜索結(jié)果頁面的很大一部分。
查看完整描述

3 回答

?
眼眸繁星

TA貢獻(xiàn)1873條經(jīng)驗(yàn) 獲得超9個(gè)贊

使用將對象轉(zhuǎn)換為單詞/索引對Object.entries()。使用迭代條目Array.reduce()。在reduce中,用迭代索引Array.forEach(),并將每個(gè)單詞分配給累加器(r)中的索引。用空格將單詞數(shù)組連接起來。


const userdata = {"\"Ten":[0],"blue":[1],"links\"":[2],"have":[3],"defined":[4],"web":[5,36,65],"search":[6,32,37,70,90,108,126],"results":[7,33,38,71,82,99,119],"for":[8,80],"the":[9,28,56,61,69,95,105],"last":[10],"fifteen":[11],"years":[12],"--":[13],"snippets":[14],"of":[15,30,63,97,107,125],"text":[16],"combined":[17],"with":[18,60],"document":[19],"titles":[20],"and":[21,46,52,85],"URLs.":[22],"In":[23],"this":[24],"paper,":[25],"we":[26,111,114],"establish":[27],"notion":[29],"enhanced":[31,81,98,118],"that":[34,54,75,113],"extend":[35],"to":[39,58,103,120],"include":[40],"multimedia":[41],"objects":[42],"such":[43],"as":[44],"images":[45],"video,":[47],"intent-specific":[48],"key":[49],"value":[50],"pairs,":[51],"elements":[53],"allow":[55],"user":[57],"interact":[59],"contents":[62],"a":[64,78,122],"page":[66],"directly":[67],"from":[68],"page.":[72],"We":[73,92],"show":[74,112],"users":[76,102],"express":[77],"preference":[79],"both":[83],"explicitly,":[84],"when":[86],"observed":[87],"in":[88,100],"their":[89],"behavior.":[91],"also":[93],"demonstrate":[94],"effectiveness":[96],"helping":[101],"assess":[104],"relevance":[106],"results.":[109],"Lastly,":[110],"can":[115],"efficiently":[116],"generate":[117],"cover":[121],"significant":[123],"fraction":[124],"result":[127],"pages.":[128]};


const result = Object.entries(userdata)

  .reduce((r, [word, indexes]) => {

    indexes.forEach(index => r[index] = word);

    

    return r;

  }, [])

  .join(' ');

  

console.log(result);


查看完整回答
反對 回復(fù) 2021-04-15
?
繁花不似錦

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個(gè)贊

您可以遍歷該對象,然后

  • 取得金鑰名稱(word

  • 使用以下位置提供的位置(indexuserdata[word]

  • 在結(jié)果數(shù)組中定義要使用的索引和單詞,例如arrResult[index] = word

然后,使用' '定界符將該數(shù)組連接到字符串中

例如:

var userdata = {"\"Ten":[0],"blue":[1],"links\"":[2],"have":[3],"defined":[4],"web":[5,36,65],"search":[6,32,37,70,90,108,126],"results":[7,33,38,71,82,99,119],"for":[8,80],"the":[9,28,56,61,69,95,105],"last":[10],"fifteen":[11],"years":[12],"--":[13],"snippets":[14],"of":[15,30,63,97,107,125],"text":[16],"combined":[17],"with":[18,60],"document":[19],"titles":[20],"and":[21,46,52,85],"URLs.":[22],"In":[23],"this":[24],"paper,":[25],"we":[26,111,114],"establish":[27],"notion":[29],"enhanced":[31,81,98,118],"that":[34,54,75,113],"extend":[35],"to":[39,58,103,120],"include":[40],"multimedia":[41],"objects":[42],"such":[43],"as":[44],"images":[45],"video,":[47],"intent-specific":[48],"key":[49],"value":[50],"pairs,":[51],"elements":[53],"allow":[55],"user":[57],"interact":[59],"contents":[62],"a":[64,78,122],"page":[66],"directly":[67],"from":[68],"page.":[72],"We":[73,92],"show":[74,112],"users":[76,102],"express":[77],"preference":[79],"both":[83],"explicitly,":[84],"when":[86],"observed":[87],"in":[88,100],"their":[89],"behavior.":[91],"also":[93],"demonstrate":[94],"effectiveness":[96],"helping":[101],"assess":[104],"relevance":[106],"results.":[109],"Lastly,":[110],"can":[115],"efficiently":[116],"generate":[117],"cover":[121],"significant":[123],"fraction":[124],"result":[127],"pages.":[128]};


let arrResult = [];


for (let word in userdata)

{

  userdata[word].forEach((i) =>

  {

    arrResult[i] = word;

  });

}

let result = arrResult.join(' ');

console.log(result);


查看完整回答
反對 回復(fù) 2021-04-15
  • 3 回答
  • 0 關(guān)注
  • 222 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號