Ad
  • Custom User Avatar

    Description is inconsistent.

    You are given an array containing elements of various data types. Your task is to return an object that will contain the number of each data type in the array.

    1. Use typeof to determine the type of each element.

    expect(typeCounter([true, false, 'test', 100, null, [1, 2], { a: 1 }, 0])).to.deep.equal({ number: 2, string: 1, boolean: 2, null: 1

    How does this not expect { boolean: 2, string: 1, number: 2, object: 3 } ?