带有for for循环的对象集用于测验

时间:2018-03-26 03:39:08

标签: javascript object set

说明:

public class HomeController : BaseController
{
    private readonly ServiceContext _context;

    public HomeController(ServiceContext context)
    {
        _context = context;
    }
}

我的代码

* Programming Quiz: Using Sets (3-1)
*
* Create a Set object and store it in a variable named `myFavoriteFlavors`. 
Add the following strings to the set:
*     - chocolate chip
*     - cookies and cream
*     - strawberry
*     - vanilla
*
* Then use the `.delete()` method to remove "strawberry" from the set.
*/

有人可以帮我修改我的代码,使其符合说明吗? 还告诉我,我可以专注于改进我的代码,因为我已经在这个测验中工作了两天。

1 个答案:

答案 0 :(得分:0)

首先创建一个Set对象,从代码中的某个位置开始,因为目前在任何地方都没有:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set

const MyFavoriteFlavors = new Set();