Array.push method what's the problem?

  • 0
    Hello everybody. Either I'm overheated already, in general, something incomprehensible.
    Who can tell? Why can't I add a new object to the array of objects using the push method?
    Why is it printing a number to my console?

    const errors = [
        isEmptyError: false,
        textError: ''
        minLengthError: false,
        textError: '',
    const newArray = errors.push({
      minLengthError: false,
      textError: 'Something',
    JavaScript Anonymous, Mar 17, 2019

  • 2 Answers
  • 0
    The push () method adds one or more elements to the end of the array and returns the new length of the array.

    Have you tried reading the documentation before using the methods?

  • 0
    The push method modifies the original array and returns the new length of the array. Try to write below console.log (errors)
    Ivy Owens

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!