Javascriptで1行のコードを理解しようとしていますが、あまり明確ではありません。javascriptをより読みやすいコードで1行変換する
this._iconNeedsUpdate = !0,this._expandBounds(t), t instanceof L.MarkerCluster ? (e || (this._childClusters.push(t), t.__parent = this), this._childCount += t._childCount) : (e || this._markers.push(t), this._childCount++), this.__parent && this.__parent._addChild(t, !0)
は、私は以下のコードを変換しようとしたが、それは動作しません:
this._iconNeedsUpdate = !0;
this._expandBounds(t);
if (t instanceof L.MarkerCluster) {
if (!e) {
this._childClusters.push(t);
t.__parent = this;
} else {
this._childCount += t._childCount;
}
} else {
if (!e) {
this._markers.push(t);
this._childCount++;
}
}
if (this.__parent) {
this.__parent._addChild(t, !0);
}
任意のアイデア作品
ライン?
ありがとうございます!あなたの助けの後
、良いコードは次のとおりです。
this._iconNeedsUpdate = true;
this._expandBounds(t);
if (t instanceof L.MarkerCluster) {
if (!e) {
this._childClusters.push(t);
t.__parent = this;
}
this._childCount += t._childCount
} else {
if (!e) {
this._markers.push(t);
}
this._childCount++;
}
if (this.__parent) {
this.__parent._addChild(t, true);
}
ありがとうございました!
私は、拡張コードの最初の3行に6つの異なるJavaScriptの概念を数えました。正確には、あなたはそれについて理解していませんか? – Quentin
この質問の[暗号化]タグは私を笑わせます。 –
拡張バージョンは機能しますが、拡張バージョンは機能しませんか?それは問題ですか? (質問を明確にしてください) – SparK