Files
freeCodeCamp/curriculum/challenges/spanish/08-coding-interview-prep/data-structures/remove-items-from-a-set-in-es6.spanish.md
2018-10-08 13:34:43 -04:00

1.4 KiB

id, title, localeTitle, challengeType
id title localeTitle challengeType
587d8254367417b2b2512c71 Remove items from a set in ES6 Eliminar elementos de un conjunto en ES6 1

Description

Practiquemos la eliminación de elementos de un Conjunto ES6 utilizando el método de delete . Primero, cree un conjunto ES6 var set = new Set([1,2,3]); Ahora elimine un elemento de su Set con el método de delete .
set.delete(1);
console.log([...set]) // should return [ 2, 3 ]

Instructions

Ahora, cree un conjunto con los enteros 1, 2, 3, 4 y 5. Elimine los valores 2 y 5, y luego devuelva el conjunto.

Tests

tests:
  - text: 'Tu Set debe contener los valores 1, 3 y 4'
    testString: 'assert(function(){var test = checkSet(); return test.has(1) && test.has(3) && test.has(4) && test.size === 3}, "Your Set should contain the values 1, 3, & 4");'

Challenge Seed

function checkSet(){
   var set = //Create a set with values 1, 2, 3, 4, & 5
   //Remove the value 2
   //Remove the value 5
   //Return the set
   return set;
}

Solution

function checkSet(){
var set = new Set([1,2,3,4,5]);
set.delete(2);
set.delete(5);
return set;}