Guest User

Untitled

a guest
Apr 25th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. // 30: array - `Array.of` static method
  2. // To do: make all tests pass, leave the assert lines unchanged!
  3.  
  4. describe('`Array.of` creates an array with the given arguments as elements', () => {
  5.  
  6. it('dont mix it up with `Array(10)`, where the argument is the array length', () => {
  7. const arr = Array.of(10);
  8.  
  9. assert.deepEqual(arr, [10]);
  10. });
  11.  
  12. it('puts all arguments into array elements', () => {
  13. const arr = Array.of(1, 2);
  14.  
  15. assert.deepEqual(arr, [1, 2]);
  16. });
  17.  
  18. it('takes any kind and number of arguments', () => {
  19. const starter = [1, 2];
  20. const end = [3, '4'];
  21. const arr = Array.of([...starter], ...end);
  22.  
  23. assert.deepEqual(arr, [[1, 2], 3, '4']);
  24. });
  25.  
  26. });
Add Comment
Please, Sign In to add comment