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

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

替換數(shù)組數(shù)組內(nèi)的空數(shù)組

替換數(shù)組數(shù)組內(nèi)的空數(shù)組

狐的傳說 2021-07-12 13:01:21
我正在使用地圖(幾個(gè)地圖在嵌套的 json 中獲取必要的元素)函數(shù)。我正在嘗試根據(jù)所需的模板從 Neo4j 數(shù)據(jù)庫中獲取輸出。在最后一張地圖中,我正在構(gòu)建所需輸出的一部分,并將其存儲(chǔ)在變量中: px.segments.map(function(pathSegment){                                                                                            individual_path.push({                             "start": pathSegment.start.properties.name,   "weight": pathSegment.relationship.properties.Weight.low,   "end": pathSegment.end.properties.name});  })然后我嘗試: console.log(individual_path);我收到以下響應(yīng)(因?yàn)槠渲幸粭l記錄在數(shù)據(jù)庫中具有空值):[ { start: 'A', weight: 0.6180339887498948, end: 'P2' } ][][ { start: 'P1', weight: 0.6180339887498948, end: 'A' },  { start: 'A', weight: 0.6180339887498948, end: 'P2' } ][ { start: 'P1', weight: 0.6180339887498948, end: 'A' } ]我的問題是,如何用非空替換空數(shù)組(在循環(huán)記錄集時(shí)),如下所示:[ { start: 'A', weight: 0.0, end: 'A' } ]最后有類似的東西:[ { start: 'A', weight: 0.6180339887498948, end: 'P2' } ] *[ { start: 'A', weight: 0.0, end: 'A' } ]*[ { start: 'P1', weight: 0.6180339887498948, end: 'A' },  { start: 'A', weight: 0.6180339887498948, end: 'P2' } ][ { start: 'P1', weight: 0.6180339887498948, end: 'A' } ]我不是很清楚,我會(huì)添加console.log(px); 輸出:Path {  start:   Node {     identity: Integer { low: 1, high: 0 },     labels: [ 'concept' ],     properties: { name: 'A', type: 'string' } },  end:   Node {     identity: Integer { low: 2, high: 0 },     labels: [ 'concept' ],     properties: { name: 'P2', type: 'string' } },  segments:   [ PathSegment { start: [Object], relationship: [Object], end: [Object] } ],  length: 1 }Path {  start:   Node {     identity: Integer { low: 1, high: 0 },     labels: [ 'concept' ],     properties: { name: 'A', type: 'string' } },  end:   Node {     identity: Integer { low: 1, high: 0 },     labels: [ 'concept' ],     properties: { name: 'A', type: 'string' } },  segments: [],  length: 0 }Path {  start:   Node {     identity: Integer { low: 0, high: 0 },     labels: [ 'concept' ],     properties: { name: 'P1', type: 'string' } },  end:如您所見,其中一個(gè)塊有一個(gè)空元素段,即第二個(gè)路徑塊。我需要的是能夠用類型的對(duì)象替換空元素(開始:'',重量:,結(jié)束:'')
查看完整描述

3 回答

  • 3 回答
  • 0 關(guān)注
  • 265 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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