我有一个像这样的复杂对象:在 Sentences 对象的每个属性中,我们有一个名为 extensions 的数组,我想删除其中的对象...
// Sentences defined for the whole course
const Sentences = {
/******** ---Sentence Start--- ********/
1: {
type: 'sentence-chunk',
duration: { start: 32.281, end: 34.608 },
difficulty: 2,
clipSentence: {
threshold: 40,
reference: "Your Majesty,* they're* ready.",
expect: "expects_sentences"
},
extensions: [
{
threshold: 41,
reference: "reference_sentence",
expect: "expects_sentences"
},
{
threshold: 42,
reference: "reference_sentence",
expect: "expects_sentences"
},
{
threshold: 43,
reference: "reference_sentence",
expect: "expects_sentences"
},
],
},
/******** ---Sentence End--- ********/
/******** ---Sentence Start--- ********/
2: {
type: 'sentence-chunk',
duration: { start: 32.281, end: 34.608 },
difficulty: 2,
clipSentence: {
threshold: 40,
reference: "Your Majesty,* they're* ready.",
expect: "expects_sentences"
},
extensions: [
{
threshold: 41,
reference: "Your Highness,* they're* ready.",
expect: "expects_sentences"
},
{
threshold: 42,
reference: "Your Majesty,* the guests are* ready.",
expect: "expects_sentences"
},
{
threshold: 43,
reference: "Your Majesty,* they're* ready.",
expect: "expects_sentences"
},
],
},
/******** ---Sentence End--- ********/
}
如果引用属性等于reference_sentence,我想删除扩展数组内的对象。
但我编写的代码无法正常工作,并且其中一个对象保持不变!
我怎样才能解决这个问题?
绝地无双
ITMISS
犯罪嫌疑人X
相关分类