Kristofer Koishigawa b3213fc892 fix(i18n): chinese test suite (#38220)
* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
2020-03-03 18:49:47 +05:30

2.1 KiB
Raw Blame History

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
587d7b7c367417b2b2512b1b Use the delete Keyword to Remove Object Properties 1 使用删除关键字删除对象属性

Description

现在你知道了什么是对象及其基本特征和优点。简而言之,它们是键值存储,它提供了一种灵活,直观的数据结构方式, 并且它们提供了非常快速的查找时间。在其余的挑战中,我们将描述您可以对对象执行的几个常见操作,以便您可以轻松地在程序中应用这些有用的数据结构。在早期的挑战中,我们都添加并修改了对象的键值对。在这里,我们将看到如何从对象中删除键值对。让我们最后一次重新审视我们的foods对象示例。如果我们想删除apples键,我们可以使用delete关键字删除它,如下所示:
删除foods.apples;

Instructions

使用delete关键字从foods对象中删除oranges plumsstrawberries键。

Tests

tests:
  - text: <code>foods</code>对象只有三个键: <code>apples</code>  <code>grapes</code>和<code>bananas</code>
    testString: 'assert(!foods.hasOwnProperty(''oranges'') && !foods.hasOwnProperty(''plums'') && !foods.hasOwnProperty(''strawberries'') && Object.keys(foods).length === 3);'
  - text: 使用<code>delete</code> <code>oranges</code>  <code>plums</code>和<code>strawberries</code>键
    testString: assert(code.search(/oranges:/) !== -1 && code.search(/plums:/) !== -1 && code.search(/strawberries:/) !== -1);

Challenge Seed

let foods = {
  apples: 25,
  oranges: 32,
  plums: 28,
  bananas: 13,
  grapes: 35,
  strawberries: 27
};

// change code below this line

// change code above this line

console.log(foods);

Solution

// solution required