Implement a function that takes an array and some other arguments then removes the other arguments from that array
This commit is contained in:
		
							parent
							
								
									01f7b854bd
								
							
						
					
					
						commit
						eeb91e5401
					
				| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
const reverseString = function() {
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const reverseString = function(input){
 | 
			
		||||
  
 | 
			
		||||
let string = input.split("").reverse().join("");
 | 
			
		||||
return string;
 | 
			
		||||
}
 | 
			
		||||
// Do not edit below this line
 | 
			
		||||
module.exports = reverseString;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,14 +5,14 @@ describe('reverseString', () => {
 | 
			
		|||
    expect(reverseString('hello')).toEqual('olleh');
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  test.skip('reverses multiple words', () => {
 | 
			
		||||
  test('reverses multiple words', () => {
 | 
			
		||||
    expect(reverseString('hello there')).toEqual('ereht olleh')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  test.skip('works with numbers and punctuation', () => {
 | 
			
		||||
  test('works with numbers and punctuation', () => {
 | 
			
		||||
    expect(reverseString('123! abc!')).toEqual('!cba !321')
 | 
			
		||||
  })
 | 
			
		||||
  test.skip('works with blank strings', () => {
 | 
			
		||||
  test('works with blank strings', () => {
 | 
			
		||||
    expect(reverseString('')).toEqual('')
 | 
			
		||||
  })
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
const removeFromArray = function() {
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
const removeFromArray = function(input) {
 | 
			
		||||
   let newString = input.slice().splice();
 | 
			
		||||
   return newString;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Do not edit below this line
 | 
			
		||||
module.exports = removeFromArray;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,22 +4,22 @@ describe('removeFromArray', () => {
 | 
			
		|||
  test('removes a single value', () => {
 | 
			
		||||
    expect(removeFromArray([1, 2, 3, 4], 3)).toEqual([1, 2, 4]);
 | 
			
		||||
  });
 | 
			
		||||
  test.skip('removes multiple values', () => {
 | 
			
		||||
  test('removes multiple values', () => {
 | 
			
		||||
    expect(removeFromArray([1, 2, 3, 4], 3, 2)).toEqual([1, 4]);
 | 
			
		||||
  });
 | 
			
		||||
  test.skip('ignores non present values', () => {
 | 
			
		||||
  test('ignores non present values', () => {
 | 
			
		||||
    expect(removeFromArray([1, 2, 3, 4], 7, "tacos")).toEqual([1, 2, 3, 4]);
 | 
			
		||||
  });
 | 
			
		||||
  test.skip('ignores non present values, but still works', () => {
 | 
			
		||||
  test('ignores non present values, but still works', () => {
 | 
			
		||||
    expect(removeFromArray([1, 2, 3, 4], 7, 2)).toEqual([1, 3, 4]);
 | 
			
		||||
  });
 | 
			
		||||
  test.skip('can remove all values', () => {
 | 
			
		||||
  test('can remove all values', () => {
 | 
			
		||||
    expect(removeFromArray([1, 2, 3, 4], 1, 2, 3, 4)).toEqual([]);
 | 
			
		||||
  });
 | 
			
		||||
  test.skip('works with strings', () => {
 | 
			
		||||
  test('works with strings', () => {
 | 
			
		||||
    expect(removeFromArray(["hey", 2, 3, "ho"], "hey", 3)).toEqual([2, "ho"]);
 | 
			
		||||
  });
 | 
			
		||||
  test.skip('only removes same type', () => {
 | 
			
		||||
  test('only removes same type', () => {
 | 
			
		||||
    expect(removeFromArray([1, 2, 3], "1", 3)).toEqual([1, 2]);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue